Subj : Re: JS_NewObject To : Jochen Stier From : Brendan Eich Date : Sun Mar 28 2004 05:17 pm Jochen Stier wrote: > Hi, > > I am us JS_NewObject inside my C++ app to create stubs for internal classes. What do you mean, exactly, by "internal class"? Can you show the code that calls JS_NewObject and stores its return value? > Is there a > a way to delete the JSObject when I delete my internal classes. I am looking > for something like JS_DeleteObject ? There is no such API, nor should there be in a GC'd runtime's API. > I know there is GC in JavaScript, but the interpretor can not know > when I delete an internal class and the corresponding JS_Object is not > needed anymore. You have to tell the engine when you no longer have an "internal class" referring to the object returned from JS_NewObject. See JS_RemoveRoot, which implies you have already called JS_AddNamedRoot passing the address of a pointer to the JSObject. The pointer's storage must remain live till you call JS_RemoveRoot, of course. /be .