This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: adding destroyable objects into Ggc
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.