Subj : Re: GC question To : lyg From : Brendan Eich Date : Wed Jun 02 2004 10:51 pm lyg wrote: > Thanks for your answer,but i am sorry, I do not understand the upper > sentence. > It seemed that the problem is solved with adding a sentence. > > JS_RemoveRoot(cx, &rootedObj); > JS_ClearScope(cx, rootedObj); > > would someone tell me why I must JS_ClearScope(cx, rootedObj)? > thanks again. You should not have to do that, but the GC must be run after the root is removed. If such a GC does not collected the object, then it must be rooted otherwise, or connected via one or more properties to a rooted object. You can use GC_MARK_DEBUG and js_LiveThingToFind to discover how it is being marked, if it is not GC'd after the JS_RemoveRoot call. /be .