Mail Archives: djgpp/1997/05/24/11:50:56
Dor (dor AT ikp DOT atm DOT com DOT pl) wrote:
: I am new in DJGPP and I know that you will be angry
: with me for so stupid question, but I couldn't find
: any function returning amount of available memory on the heap.
: I was looking in C library manual but in section "Memory"
: there is only allocation in million ways, copying memory
: blocks, freeing allocated memory, but how much space there is ?
It's difficult to say. Since DJGPP uses a DPMI server to get the memory,
it all depends on what the DPMI server will tell you. They all vary in how
much they give, anyway. There are DPMI calls to return available physical
memory and virtual memory (I can't remember the names offhand; type `info
libc a' and look at __dpmi_remaining_*_memory perhaps), but as I just said
they aren't completely reliable. One point is that if you malloc memory
then free it it won't go back to the DPMI server; it remains in a `pool'
of memory, which is still available for mallocs.
In general, though, you shouldn't worry too much about available RAM;
since it's DPMI, you'll get a heck of a lot of it in general. CWSDPMI is
particularly generous; you get any free physical (up to 128Mb) plus any
free hard disk space as virtual memory, up to 128Mb again, for a maximum
of 256Mb.
Windows isn't quite so generous; I'm not sure about 3.x, but in Win95 you
should set the DPMI memory (right-click, properties, memory) to 65535 IIRC
(type it, it's not on the list). Otherwise you don't get given much.
Of course, a simple way to find out whether you can allocate what you want
is to do it in one block at the start, and see whether you're given it or
not.
--
George Foot <mert0407 AT sable DOT ox DOT ac DOT uk>
Merton College, Oxford
What's the wizard's password for? (dunnet)
- Raw text -