Hi,

I am using WebKit JSAPI to create my own JS object, looks like there is memory 
leak when calling JSObjectMake()/JSValueUnprotect().

My calling sequence like follow:
 {
    myJSClass = JSClassCreate(&my_jsclass_def);
    myJSObj = JSObjectMake(context, myJSClass, NULL);
    JSClassRelease(myJSClass);
    ...
    JSValueUnprotect(context, myJSObj);
 }

I looked into WebKit, after JSValueUnprotect was called, while garbage 
collector try to delete the object, ref-count of jsClass was not 0 at the time, 
so it was not deleted. If I have a big list of property or functions in myJSObj 
and frequently create/release the object, it will cause big memory problem.

I traced the reference counter of the object, there are two places to increase 
it:
   1. creating JSCallbackObjectData
   2. creating OpaqueJSClassContextData

While garbage collector deletes the object, the first one got deref but second 
one did not.
After I force to deref it,  I saw ~OpaqueJSClass() was called. however still 
have problem to remove OpaqueJSClassStaticValuesTable

Can any one help to check if I missed some thing from my calling function or if 
it is memory leak in the API, any comment how to fit it?

Thanks,
Victor

                                          
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3
_______________________________________________
webkit-help mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help

Reply via email to