[Gc] System V contexts and stack marking

Brian Koropoff bkoropoff at gmail.com
Thu Aug 9 21:13:20 PDT 2007


Greetings,
    I'm developing an interpreted language runtime that snarfs the Boehm GC
to provide automatic memory management.  My language uses a userspace
threading model based on System V contexts.  I encountered a major issue
with this architecture: if the collector runs in a fiber, it will attempt to
mark between the cold end of the main stack and the hot end of the fiber
stack, hitting an unmapped page in the process and segfaulting.
    A quick workaround was to wrap setcontext() and swapcontext() to update
GC_stackbottom.  However, this will cause the main stack to no longer be
marked.  I'm wondering if there is a reasonable solution to this problem
that uses only the public APIs.  I can think of several ways to approach the
issue by modifying the collector, but I'd rather avoid having my language
depend on a custom version.
    Any suggestions would be appreciated.

-- Brian Koropoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20070809/5feab171/attachment.htm


More information about the Gc mailing list