<p dir="ltr">Hello, everyone. </p>
<p dir="ltr">I'm working on a glib binding for JavaScriptCore and to achieve that, I need to better understand JSC memory management and object lifecycles.</p>
<p dir="ltr">What I could figure from the source is that JSContextRef is protected on creation and must be freed manually. </p>
<p dir="ltr">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.</p>
<p dir="ltr">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.</p>
<p dir="ltr">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? </p>
<p dir="ltr">Thanks in advance </p>
<p dir="ltr">Estêvão Samuel Procópio Amaral <br></p>