Subj : Re: JS_GC question! To : richardl From : Brendan Eich Date : Thu Dec 11 2003 12:11 pm richardl wrote: > I embedded spidermonkey to a mini-browser. It works but: > > Having problem when running the following script: > > > > > After I clicked twice the button, out of memory occured! See JS_SetBranchCallback. You should be using it to set a branch callback that calls JS_MaybeGC on every 0 mod N branch-counter sample, where N is a large power of two (and the counter is unsigned). > So I have to put JS_MaybeGC(cx) after each EvaluateScript() call. You don't have to do that. > It helps > to gain back the memory, but I found it is not stable any more. > > It often causes crash in > js_FindProperty(JSContext * 0x0126e640, long 19227776, JSObject * * > 0x00faf630, JSObject * * 0x00faf62c, JSProperty * * 0x00faf5b0) line 1439 + > 33 bytes > > The statement is if (!OBJ_LOOKUP_PROPERTY(cx, obj, id, &pobj, &prop)) > return JS_FALSE; > > obj is not a valid JSObject structure. It looks like the memory is > corrupted. Are you using GC roots properly? See http://www.mozilla.org/js/spidermonkey/gctips.html and related docs in the same directory. /be .