This is the mail archive of the gcc-patches@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: [PATCH]: Add ggc_free to ggc-zone



On Jan 30, 2004, at 5:58 PM, Richard Henderson wrote:


On Fri, Jan 30, 2004 at 05:39:28PM -0500, Daniel Berlin wrote:
+#ifdef ENABLE_GC_CHECKING
+  /* Poison the chunk.  */
+  poison_chunk (chunk, ggc_get_size (p));
+#endif

The point of the default is to avoid the ifdef.

Whoops. I originally had some more code in there while debugging it , but i got rid of it and forgot that poison_chunk is a noop with checking off.


+ free_chunk (chunk, ggc_get_size (p), &main_zone);

Don't you have to find out what zone it really came from?
Not really, since it's free, it doesn't really matter what zone's free chunk list you put it on.
It just means the page won't be freed if you put it in the wrong zone, at worst (and this is only the case for small objects). It'll still be reused.
Also, we don't ggc_free anything that isn't in the main zone right now.


But if you really want, i can make it figure out the zone, though it is very expensive, because we have no page table anymore.
That is, unless i start tracking the high and low address of each zone (i could then see which zone the memory belongs to), since the zone memory space should be contiguous.
Or I could annotate each chunk with a zone number. I'd have to steal a few bits from somewhere to do this.
The alternative to these solutions is to make ggc_free a noop.
--Dan



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