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: gc question



I have a collector that is based on the zone collector that can do this, because it marks each allocation with the typecode (by having a ton of different ggc_alloc macros).

Other than that, you probably can't do this easily.
I don't mind doing some post-processing, or hacking into the allocator to
do something like build a hash table of things I care about, invalidating
them if they're released, etc etc.

Well, okay, in that case, the easiest way to do this is as follows:


1. Change the ggc_alloc_typed stub in ggc-page to record the memory it assigns for the things you want to track.
2. Make sure you remove these things when they get freed.
3. Change the varray/phi_node allocations to use ggc_alloc_typed with an argument (You can find the enum list in gtype-desc.h in the build dir).
4. Do what you want with the results.


It might be easier to do this with ggc-zone (configure --with=gc-zone), since it already stores the typecodes with each object allocated using ggc_alloc_typed in the object.
So you can tell, when an object is freed, what it's typecode was, without having to mess around with hashtables and whatnot.




Basically I want to accomplish two things. First, nodes that I know should
have been collected were actually collected. Second, I'm seeing some odd
stuff with varrays which makes me wonder if somewhere, somehow we're
holding on to some pointers to them and not collecting the varrays.


jeff



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