Subj : Re: help with GC To : netscape.public.mozilla.jseng From : "Jashin Eugene" Date : Wed Sep 17 2003 01:01 pm thanks a lot! anyway docs at JS_Add[Named]Root is short of fact, that pointer to pointer must be valid till the JS_RemoveRoot call.. "Brendan Eich" wrote in message news:3F6736C5.7050709@meer.net... > 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 > .