[Gc] Re: Program broken

Boehm, Hans hans.boehm at hp.com
Thu Sep 24 11:55:53 PDT 2009


> From:  Hugh
> 
> It has 100 thousand line. It's difficult to reduce the program. 
> 
> I used some static global var and pointers. In some func I 
> put objects( created with new (GC) XXX) to that static global 
> vars. Is this right? Is the gc will collect object correctly?

As Ivan stated, this should work correctly.

In a C++ program, if you don't replace malloc (which probably doesn't work on Windows CE?) you have to be careful to avoid storing pointers in memory that's dynamically allocated, but not allocated through the GC.  This normally means that you have to explicitly use GC-aware allocators in STL containers, for example.

There are some debugging hints in http://www.hpl.hp.com/personal/Hans_Boehm/gc/debugging.html , but those are tailored more towards C programs.  My first guess would be that you have issues with pointers stored in memory allocated through the system malloc.

Hans 


More information about the Gc mailing list