Re: [Gc] Re: Want to find reason of heap size keep growth

Ivan Maidanski ivmai at mail.ru
Fri Jul 9 02:39:17 PDT 2010


Fri, 9 Jul 2010 03:10:25 +0000 (UTC) biosli <biosli at hotmail.com>:

> biosli <biosli at ...> writes:
> 
> > 
> > Hi, all:
> > 
> > I add gc, build with macro SMALL_CONFIG, USE_MUNMAP, GC_THREADS and 
> > ALL_INTERIOR_POINTERS, in my Windows Mobile project.
> > 
> > I think gc may not free all memory block I no longer used(which didn't call 
> > GC_Free), that make the heap size keep growth.
> > 
> > I want to find reason of that, how can I print debug info with call chain of 
> > the heap holded pointer.
> > 
> > Thanks a lot.
> > 
> 
> Hi all,
> 
> There is a further test for heap size growth.
> 
> I checked GC_dump(), finding when heap size grows.
> 
> I got the following warnings:
> 
> GC Warning: Repeated allocation of very large block (appr. size 2305024):
> 	May lead to memory leak and poor performance.
> 	
> Then the heap size grows.
> 
> I've used GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE malloc large block (as bitmap array, 
> data array, or string).

If possible, call GC_set_all_interior_pointers(0) before GC_INIT() and use GC_MALLOC[_ATOMIC].

This strategy solved my similar problem: http://article.gmane.org/gmane.comp.programming.garbage-collection.boehmgc/2532

> 
> Can you kindly advise how i can prevent this warning from happening?

Turning it off (in a release code) is easy:

#define GC_IGNORE_WARN
#include "gc.h"

main() {
 GC_INIT();
 ...
}

But, of course, you should be aware that it "May lead to poor performance" and to running out of memory.

> 
> Thanks for all you help.



More information about the Gc mailing list