[Gc] Re: Program broken
up2dream at gmail.com
Wed Sep 23 21:04:09 PDT 2009
Boehm, Hans <hans.boehm at ...> writes:
> > From: Ivan Maidanski
> > [Hugh:]
> > > How can I
> > > know a object is already collected?
> > GC_base(p) should be 0 if p has been collected (but this is
> > not guaranteed since the memory might be already reused by
> > other objects).
> If p was just added back to a small object free list, GC_base(p) will remain
nonzero. But if it's a
> pointer-containing (non-"atomic") object, the object will have been cleared
except for a free-list
> link in the first word. If the object was around at the last collection,
but the collector hasn't yet gotten
> around to reclaiming memory in that section of the heap, the object will
still look OK, but
> GC_is_marked(p) will be zero (as it will if the object was allocated since
the last collection, so this is a
> bit tricky).
> For something like this, the other thing that might help is to post the
smallest, simplest program you can
> construct that exhibits the problem, assuming you can reduce it to less than
100 lines or so. Often I find
> problems during attempts to do this kind of thing. If not, this makes it
much easier for others to help,
> particularly if the problem turns out to be platform independent. Even if
it's platform-dependent, we
> then know better where to look.
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?
More information about the Gc