[Gc] Faster to not call GC_free?

Bruce Hoult bruce at hoult.org
Mon Jun 4 17:14:20 PDT 2007

On 6/5/07, jim marshall <jim.marshall at wbemsolutions.com> wrote:
> for example is there a set size of data that the GC will add to the ptr?
> so I can maybe do
> memset(cptr, 0, ptrSize - GC_MEM_SIZE)

The GC does not store any data in the objects that it gives you, and
doesn't store any GC data next to them either  It gives you the same
size or slightly larger object than you asked for.  You can write
freely into it.

Of course if you put a C++ object in there then you have to watch out
for VTBL pointers, which could be anywhere (with multiple
inheritance).  But you're doing this after you're sure that you're
never going to reference this object again, right?  So it's fine.

The only thing you can't do is clear the object *after* doing a
GC_FREE() on it.  It does have a link field in it then.

More information about the Gc mailing list