Garbage Collector interface - GTY
Josef Zlomek
zlomj9am@artax.karlin.mff.cuni.cz
Sat Feb 22 23:09:00 GMT 2003
> > Hi,
> >
> > Although I know how to tell garbage collector to mark simple
> > datastructures, I have a problem with the following one which is more
> > complicated. I have read the documentation but it is too brief for me.
> >
> > The data structure is a dynamic array, each element is a struct of
> > two members - the first and the last element of the chained list. The
> > nodes (and their internals) of the chained list should be garbage
> > collected I do not know how to tell GC not to mark the struct itself.
>
> This is not supported, by design. Anything that refers to a GCed
> object must be either a global variable or must be GCed itself; you
> can't have references to GCed objects in malloced memory.
So its better to split the array of structures to 2 arrays, right?
GTY machinery would be used for one of them (the main one),
the second (auxiliary) one will not be marked.
Josef
More information about the Gcc
mailing list