[Gc] Failure to expand heap under cygwin

Peter Ross pro at missioncriticalit.com
Thu Mar 16 16:10:30 PST 2006


While I was searching for information about the cygwin mmap routine I
came across the two following pieces of information.

The first one, By default no Cygwin program can allocate more than 384
Mb (about 400Mb) of memory (program+data), see the following link
<http://cygwin.com/cygwin-ug-net/setup-maxmem.html>.  I changed the
heap_chunk_in_mb to 128 and got similar behaviour but earlier, so
for now I've just increased this value to 1024 Mb.

Regarding however the use of mmap,

  Unfortunately however, because Cygwin's malloc and mmap logic each
  consume completely different portions of Windows' virtual memory, the
  more memory that is reserved for malloc usage (via using a larger
  "heap_chunk_in_mb" value), the LESS becomes available for mmap usage!

from <http://www.bsp-gmbh.com/hercules/distarchs/index.html> seems to
imply that if one used mmap then don't increase the size of
heap_chunk_in_mb registry key

Once again thanks for the help.
Pete

On Wed, Mar 15, 2006 at 01:31:15PM -0800, Boehm, Hans wrote:
> It looks to me like we call GC_unix_get_mem through the GET_MEM macro to
> expand memory under Cygwin.  This calls sbrk unless USE_MMAP is defined.
> Sbrk is constrained to contiguous memory, so presumably the address
> space layout is such that 400MB is all you get.
> 
> You might try building the collector with USE_MMAP.  I'm not sure this
> has been tried under Cygwin, but I don't see any fundamental reason it
> shouldn't work, assuming Cygwin implements mmap adequately.
> 
> The GC_unix_get_mem implementation is pretty trivial (assuming you find
> the right one!), so I think it should be easy to deal with this,
> assuming there is a way to get the memory from Cygwin.  If that turns
> out to be nontrivial, you might want to ask on a Cygwin list.  Please
> post answers here, though.
> 
> Hans
> 
> > -----Original Message-----
> > From: gc-bounces at napali.hpl.hp.com 
> > [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Peter Ross
> > Sent: Wednesday, March 15, 2006 1:02 AM
> > To: gc at napali.hpl.hp.com
> > Subject: [Gc] Failure to expand heap under cygwin
> > 
> > Hi,
> > 
> > I'm trying to run an application under cygwin on Windows XP 
> > which uses the boehm gc.
> > 
> > I get to about 400Mb of memory usage (virtual and physical) 
> > on a machine with 1.2Gb of memory when I get the following 
> > printed out with logging enabled.
> > 
> > Increasing heap size by 262144 after 90325200 allocated bytes 
> > Failed to expand heap by 16777216 bytes Increasing heap size 
> > by 262144 after 90675252 allocated bytes Failed to expand 
> > heap by 16777216 bytes Increasing heap size by 262144 after 
> > 91024200 allocated bytes Failed to expand heap by 16777216 
> > bytes Failed to expand heap by 262144 bytes GC Warning: Out 
> > of Memory!  Returning NIL!
> > 
> > I've searched the archives and to me it doesn't look like I'm 
> > running out of virtual memory.  Any other ideas on what could 
> > be going on?
> > 
> > The full log can be found at
> > http://mail.missioncriticalit.com/~petdr/gc/gc.log.gz
> > 
> > Regards,
> > Peter
> > -- 
> > Software Engineer                                (Work)   +32 
> > 2 757 10 15
> > Mission Critical                                 (Mobile) +32 
> > 485 482 559
> > _______________________________________________
> > Gc mailing list
> > Gc at linux.hpl.hp.com
> > http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> > 
> 

-- 
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559


More information about the Gc mailing list