[Gc] Ignoring certain pointers in C++?

Johann 'Myrkraverk' Oskarsson myrkraverk at yahoo.com
Thu Apr 19 13:10:33 PDT 2007


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.

Do I use weak pointers for this?  Or do they serve a different
purpose?  Is it enough to put my notification code in the destructor
of my factory created class?


More information about the Gc mailing list