[webkit-dev] how to destroy JSObjescts?

Iulian iliescu.iulian at gmail.com
Wed Nov 26 01:23:04 PST 2008

This is not what i want. I just want to avoid memory leaks.
With JSGarbageCollect is a little better, but not perfect.

I'll try to explain my scenario, maybe this will help.

I extended GTKLauncher to provide aditional JavaScript objects.
Actually i create two objects:
One with JSObjectMake(), called myStaticObject, that has some static values
and a finalize function.
One with JSObjectMakeConstructor(), called myDynamicObject, that will be
used with new() and has initialize() and finalize() functions.

I start the GTKLauncher with a page that contains my JavaScript code, that
creates a myDynamicObject with new() and them i close the application.

With JSGarbageCollect() the finalize() function of myStaticObject gets
called, but the finalize() function of myDynamicObject doesn't get called.

Without JSGarbageCollect() no finalize() function gets called.


Alexey Proskuryakov-4 wrote:
> Nov 26, 2008, в 10:47 AM, Iulian написал(а):
>> The class definition of my object has initialize() and finalize().
>> When i load the page that contains "MyObject obj= new MyObject();" the
>> object is constructed and the initialize() is called. Unfortunatelly  
>> this
>> object is never garbage collected (not even when the browser is  
>> closed).
>> I tried putting JSObjectDeleteProperty but nothing changed.
> If you want to trigger garbage collection explicitly, you can use  
> JSGarbageCollect function.
> - WBR, Alexey Proskuryakov
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

View this message in context: http://www.nabble.com/how-to-destroy-JSObjescts--tp20684186p20697353.html
Sent from the Webkit mailing list archive at Nabble.com.

More information about the webkit-dev mailing list