[gclist] Boehm's collector and "dynamic roots"

Ji-Yong D. Chung virtualcyber@erols.com
Thu, 1 Mar 2001 00:36:37 -0500


    I am having a problem with getting
Boehm's collector to work for me.  I was wondering
if anyone could help.

    I have just incorporated Boehm's collector for my
scheme interpreter.  It is implemented in C++.
The interpreter keeps its own stack (rather than using 
C++ stack).  To get the collector
to scan "my" stack, I registered it as a
root segment using one of the
interfaces provided by Boehm's collector.

    My problem is that I have allocated approximately
200k for the stack, and on each collection cycle,
Boehm's collector is likely to scan the whole thing
as one of its roots.

    If I were using a C++ stack, Boehm's collector would just
scan the stack until it reached the top.  Because my stack 
is not a C++ stack, and it is registered as a root
segment, Boehm's collector
is treating it as just that -- a root segment
rather than as stack.

    I am wondering if there is any way to cause
the collector to scan only to the top of MY OWN
stack, rather than the whole 200k.

    For this, it seems that I need to implement
additional interfaces that could add
what one may call "dynamic" roots -- roots
whose size will change when I push
my stack.
    Has anyone encountered a similar problem
before, and know of a relatively simple solution
to this problem?  (Perhaps a few pointers
to how I might need to modify Boehm's 

    I would appreciate any comments/enlightenment.