Subj : Re: help with GC To : Jashin Eugene From : Brendan Eich Date : Tue Sep 16 2003 10:13 am Jashin Eugene wrote: >ok, i already understood that i must call JS_AddRoot(cx, &gc_obj); instead >of.. >but can gc_obj variable be a stack variable? > > Sure, why not? You can take the address of a stack variable. You need to JS_RemoveRoot that pointer by reference before it goes out of scope, of course. If you need a root only locally, perhaps you can use a local root. See http://www.mozilla.org/js/spidermonkey/gctips.html. /be .