[jsc-dev] JSValueRef lifecycle

tevaum at gmail.com tevaum at gmail.com
Mon Nov 28 09:17:55 PST 2016


Hello, everyone.

I'm working on a glib binding for JavaScriptCore and to achieve that, I
need to better understand JSC memory management and object lifecycles.

What I could figure from the source is that JSContextRef is protected on
creation and must be freed manually.

What is getting me confused is about values. You have to pass a
JSContextRef when creating a JSValueRef, but I couldn't find if the
JSContextRef saves the reference of the value or the values saves the
reference of the context.

There's no API to free or unref values, so my first thought was that the
context should take a reference of the value and free it when the context
is destructed. But, as I said, I just couldn't find that on the code.

So I'm asking you guys: what happens with values? Are they just garbage
collected? Do they keep a reference of the context or the other way around?
Is there a place where I can learn more about JSC besides the code?

Thanks in advance

Estêvão Samuel Procópio Amaral
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/jsc-dev/attachments/20161128/c5c0f174/attachment.html>


More information about the jsc-dev mailing list