This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: adding destroyable objects into Ggc


On Thu, 20 Oct 2011, Basile Starynkevitch wrote:

On Thu, Oct 20, 2011 at 09:11:02AM +0200, Marc Glisse wrote:
On Thu, 20 Oct 2011, Basile Starynkevitch wrote:
PPL [Parma Polyhedra Library] data, like e.g. ppl_Constraint_t
[from header <ppl_c.h> that is, using a C API] comes to mind. If
you want to share PPL stuff between several passes, it can be very
handy to add PPL data inside GTY-ed stuff. If that GTY-ed stuff is
deleted by Ggc, and if the PPL destructor (e.g.
ppl_delete_Constraint in that case) is not called, you get a
memory leak.

Or you could imagine the garbage collector also reclaiming that memory.

Yes, but that precisely is the finalization machinery we are talking about.

Er, if there is a leak, it means that memory is not referenced anymore, so it is up to the garbage collector to pick it up. If only some objects are marked for garbage collection, that may require some extra steps, but in principle, in the general context of garbage collection, I don't see why that would require a finalizer. Would you care to explain?


--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]