Mail Archives: djgpp/1994/11/04/21:02:29
Hi Pete
Yoy asked:
> How do I find out, just before allocating the array,
> exactly how much free RAM is available ? If I could know this, I
> could always make sure that no swapping do disk occurs and at the
> same time ensure full usage of RAM.
> I have tried looking through the mem.h and dos.h headers and all the
> doumentation, but I seem to be unable to find out how to do this.
The standard memory functions can't tell the difference between normal
memory and memory swapped to disk and that's exactly the meaning of
virtual memory. Programs shouldn't notice (except for speed).
You have to ask the virtual memory manager, in this case the DJGPP dos
extender go32, or if running under DPMI, this memory manager (Windows
dos box, QEMM with DPMI support, etc.). In either case you can call a
go32 function called _go32_dpmi_remaining_physical_memory() (prototyped
in dpmi.h) or you can call the DPMI service "Get Free Memory
Information" (int 0x31 with AX = 0x0500).
The DJGPP package includes a sample in samples/dpmi/dpmimem.c wich,
among other things, uses the above mentioned go32 function.
Kim Jersin
- Raw text -