[Gc] stack problem

Romano Tenca rotenca at gmail.com
Wed Oct 1 07:55:43 PDT 2008

Boehm, Hans ha scritto:
> GC_get_stack_min() walks the stack towards lower addresses, possibly one page at a time, looking for the lowest (hottest) committed address in the stack.  It calls VirtualQuery for each page, which I would guess is where the time goes.  The result is used as a plausibility check on the stack pointer.  If the sp fails the plausibility check (hopefully very rare), GC_get_stack_min() is used instead of the sp for stack scanning.  I suspect this code was there to deal with assembly code that didn't correctly mainatin the stack pointer, though this seems like the kind of code you really want to rely on as little as possible.
I have done some control on my program, and i see that GC_get_stack_min 
is called many times in a row by GC_register_dynamic_libraries -> 
GC_cond_add_roots -> GC_get_next_stack and always with the same address 
to check.
> Hans
> regards
Romano Paolo Tenca

More information about the Gc mailing list