Subj : Re: Which objects need to be deleted? To : netscape.public.mozilla.jseng From : Brendan Eich Date : Mon Sep 29 2003 12:27 pm Yuraukar wrote: > Where can I find information about which objects/pointers returned > from JS functions in C++ need deletion? > For example: > > ok = JS_ExecuteScript(cx, glob, script, &rval); > JSString *str = JS_ValueToString(cx, rval); > char *s = JS_GetStringBytes(str); > printf("script result: %s\n", s); > > Do I need to delete "str"? Do I need to delete "s"? > > The same with the return value of > JS_NewStringCopyZ(cx,.....) Don't delete anything. JS is garbage collected. Have you read the docs at http://www.mozilla.org/js/spidermonkey/ yet? Especially gctips.html? /be .