adding destroyable objects into Ggc
Duncan Sands
baldrick@free.fr
Tue Oct 18 16:43:00 GMT 2011
Hi Basile,
> I would like to add destroyable objects into Ggc (the GCC garbage collector, see files
> gcc/ggc*.[ch]).
>
> The main motivation is to permit C++ objects to be garbage collected (I discussed that
> briefly in the Gcc meeting at Google in London): adding destroyable object is a
> prerequisite for that goal.
it is already possible to have garbage collected C++ objects with destructors.
I use this in the dragonegg plugin (see the file Cache.cpp). I do only use
htab's though, which comes with support for destructors. After allocating the
garbage collected memory, I construct the object using placement new. The
memory is allocated using htab_create_ggc, the last argument of which is a
destructor function which in my case does a call to the objects destructor.
Ciao, Duncan.
More information about the Gcc
mailing list