[webkit-dev] how to destroy JSObjescts?

Timothy Hatcher timothy at hatcher.name
Tue Nov 25 08:49:24 PST 2008


JavaScript objects and the JavaScriptCore API objects (except  
JSStringRef) are garbage collected. So sometime after the last  
reference goes away, they will release their memory.

In this case when the global object goes away. If you want to  
"release" them, you can call JSObjectDeleteProperty to remove the  
reference.

You also need to call JSStringRelease here when you are done with the  
jsstr variable.

On Nov 25, 2008, at 8:05 AM, Iulian wrote:

>
> I create several JSObjects like this:
>
>    js_object= JSObjectMakeConstructor(context, object_jsclass,
> Object_Constructor);
>    globalObject = JSContextGetGlobalObject(context);
>    jsstr = JSStringCreateWithUTF8CString("MyObject");
>    JSObjectSetProperty(context, globalObject, jsstr, js_object,
> kJSPropertyAttributeNone, NULL);
>
>> From JavaScript i have: "MyObject obj= new MyObject();"
>
> The problem is that the objects are never destroyed.
> What can i do to release all these objects?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20081125/ce212290/attachment.html>


More information about the webkit-dev mailing list