[Gc] Corrupting internal data structures

David Chisnall theraven at theravensnest.org
Sun May 29 09:56:04 PDT 2011


Hi,

I have been having a lot of problems debugging applications using the collector.  I think I am suffering from a use-after-free error somewhere (caused by a pointer being stored somewhere that the GC can't see it), but unfortunately the collector seems to reallocate the block of memory that I have a pointer to for its own use.  The symptom I then see is usually a crash somewhere in the collector's data structures.  I briefly saw errors saying something had written past the end of an allocation, but that seems to have gone away again.  I was wondering:

1) Is it possible to tell the collector to allocate memory for internal use from a separate block?  This would make it much easier to track down errors in the client code.

2) Is it possible for the collector to refrain from reallocating memory that has been recently freed for a while?  This would allow it to be left filled with some known value to make sure that nothing is modifying it. Or, even better, can the page protection logic in the incremental collector be used to abort on any writes to unallocated memory?

David


More information about the Gc mailing list