[Mono-dev] RFC: GC precise scanning of stacks

Dick Porter dporter at codicesoftware.com
Mon Sep 28 07:18:26 EDT 2009

Hi all

We think some of our 'leak' issues can be attributed to libgc's
false-positive identification of pointers.

Attached is a proof-of-concept patch to libgc (and a simple
demonstration program) that I hope will be the start of GC precise stack
scanning.  The code should apply easily to sgen as well.

It basically adds an extra variable to the stack which contains specific
markers and references to all the pointers that will contain GC-alloced
memory.  There is an optional failsafe mode that will fall back to the
current 'all stack is scanned' code if the markers are not seen.

This code will cover objects on unmanaged stacks but I don't know what
will be needed for managed code.  I presume the JIT can add the same
sort of marker to the stack?

So, comments?  Is this technique going to be workable?

- Dick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gc-precise.diff
Type: text/x-patch
Size: 4058 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090928/9912974d/attachment-0006.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gc-precise.c
Type: text/x-csrc
Size: 2052 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090928/9912974d/attachment-0007.bin 

More information about the Mono-devel-list mailing list