[Gc] Ignoring certain pointers in C++?

Bruce Hoult bruce at hoult.org
Thu Apr 19 16:06:34 PDT 2007

On 4/20/07, Johann 'Myrkraverk' Oskarsson <myrkraverk at yahoo.com> wrote:
> Hi,
> I'll admit that I'm mostly playing with Gc, or plain using it by
> deriving from the gc class.
> Now, in order not to have duplicates of a certain type of object I
> constructed an object factory that returns a pointer to an already
> existing one, if it's already been allocated with those parameters.
> For this I hold a list of all objects of this kind, so they are
> perpetual.  Is it possible to tell Gc not to check this pointer
> collection when collecting?  I'm currently using a link list for these
> pointers, so I would need to be notified when an object is reclaimed
> if I keep that structure.

register_disappearing_link is probably the way to go for this.  Just
make sure that your pointer collection does something sensible when it
finds that what used to be a pointer to an object is now null -- e.g.
deletes the linked list node.

More information about the Gc mailing list