Mail Archives: djgpp/1996/07/08/09:42:49
From: "Sven A. Havemann" <havemann AT uran DOT informatik DOT uni-bonn DOT de>
Date: Fri, 5 Jul 1996 16:42:24 -0600
I seem to have a problem with virtual memory management; to test it, I
wrote a little program allocating and using large amounts of memory (64 million
int-numbers).
<SNIP>
I have a P75 with 40 Megs of Ram, the VM swap partition is c: (115M free)
and DJGPP is installed on e: (127M free)
<SNIP>
There are two problems here. First, assuming that by 64 million int-numbers
you mean something like: int fred[64000000] or an equivalent malloc. The
problem with this is that such an allocation takes up 256,000,000 bytes of
virtual memory and as you state you have only 155MB of virtual memory available
(40MB physical and 115MB swap). The second problem is related, if you meant:
int *fred = malloc(64*1024*1024);
then know that DJGPP malloc allocates a block rounded to the next largest power
of two so that this malloc actually does an sbrk(128*1024*1024) allocating
536,870,912 bytes of VM rather than the expected 268,435,456 bytes (NB that
this means that the former allocation is really 268,435,456 bytes not
256,000,000 bytes). Either way you do not have enough virtual memory.
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -