[Gc] [PATCH] Re: GC memory leak on OSX Tiger

Boehm, Hans hans.boehm at hp.com
Fri Jan 13 17:58:39 PST 2006


Thanks.

I added this to my gc6.X tree, and checked it into the gc7 tree (with no
further testing, since I currently don't have MacOS access).

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Bruce Mitchener
> Sent: Saturday, December 31, 2005 2:39 PM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] [PATCH] Re: GC memory leak on OSX Tiger
> 
> 
> This is due to task_threads() allocating an array in 
> darwin_stop_world.c 
> that is not then deallocated with vm_deallocate().
> 
> This can be fixed with this trivial attached patch.
> 
> I've only tested it under OS X 10.4.3 as that's all that I have handy.
> 
> - Bruce
> 
> Bruce Hoult wrote:
> > It seems that there is a memory leak on both 6.5 and 6.6 under OSX
> > 10.4.3.
> > 
> > #include "gc.h"
> > 
> > int main(){
> >      while(1){
> >          GC_malloc(10000);
> >      }
> >      return 0;
> > }
> > 
> > ... continuously increases the various memory sizes in top.  I set
> > GC_PRINT_STATS and stopped it when top showed RPRVT hitting 256 MB  
> > (which takes about 15 seconds).  The last GC messages 
> before I kill  
> > it are:
> > 
> > Initiating full world-stop collection 16977 after 50020 allocd bytes
> > --> Marking for collection 16977 after 50020 allocd bytes + 11420
> > wasted bytes
> > Collection 16976 finished ---> heapsize = 65536 bytes World-stopped 
> > marking took 10 msecs Complete collection took 10 msecs
> > Initiating full world-stop collection 16978 after 50020 allocd bytes
> > --> Marking for collection 16978 after 50020 allocd bytes + 11420
> > wasted bytes
> > Collection 16977 finished ---> heapsize = 65536 bytes World-stopped 
> > marking took 0 msecs Complete collection took 0 msecs
> > 
> > Changing the allocation size to 1 byte, it takes about 30 seconds to
> > grow RPRVT to 256 MB, with final messages when I kill it being:
> > 
> > Initiating full world-stop collection 17107 after 65528 allocd bytes
> > --> Marking for collection 17107 after 65528 allocd bytes + 0 wasted
> > bytes
> > Collection 17106 finished ---> heapsize = 65536 bytes World-stopped 
> > marking took 0 msecs Complete collection took 0 msecs
> > Initiating full world-stop collection 17108 after 65528 allocd bytes
> > --> Marking for collection 17108 after 65528 allocd bytes + 0 wasted
> > bytes
> > Collection 17107 finished ---> heapsize = 65536 bytes World-stopped 
> > marking took 0 msecs Complete collection took 0 msecs
> > 
> > The results are much the same with any other allocation amount I
> > tried (10, 100, 1000, 100000, 1000000 bytes) although of 
> course the  
> > stable heap size is larger for the larger allocation sizes.
> > 
> > It appears to me that the GC is leaking on the very close order of
> > (perhaps even exactly) 16 KB per collection, even though the heap  
> > size is staying perfectly stable.
> > 
> > I built the gc with no arguments to ./configure.  "make check"
> > passes.  My gcc is:
> > 
> >    powerpc-apple-darwin8-gcc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc.
> > build 5247)
> > 
> > There is no problem on my x86 Linux machine.
> > 
> > I first noticed the problem when trying to calculate fib(1000000)
> > with the naive iterative method using Gwydion Dylan's built 
> in bignum  
> > implementation.  I had gc6.5 installed as I have some some time.   
> > Installing gc6.6 didn't help.
> 
> 



More information about the Gc mailing list