www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/07/08/09:42:49

From: kagel AT quasar DOT bloomberg DOT com
Date: Mon, 8 Jul 1996 09:35:19 -0400
Message-Id: <9607081335.AA10047@quasar.bloomberg.com >
To: havemann AT uran DOT informatik DOT uni-bonn DOT de
Cc: djgpp AT delorie DOT com, havemann AT uran DOT informatik DOT uni-bonn DOT de
In-Reply-To: <9607051642.ZM24979@Terra.informatik.uni-bonn.de> (havemann@uran.informatik.uni-bonn.de)
Subject: Re: Probs: Virtual mem, V2+4DOS
Reply-To: kagel AT dg1 DOT bloomberg DOT com

   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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019