[jsc-dev] JSValueRef lifecycle
Geoffrey Garen
ggaren at apple.com
Mon Nov 28 16:04:41 PST 2016
Using the C API, you need to maintain a reference to the JSContextGroupRef. One way to do that is to maintain a reference to the JSContextRef.
Geoff
> On Nov 28, 2016, at 3:33 PM, tevaum at gmail.com wrote:
>
> Thanks, Geoff.
>
> One more thing, if I use JSRetainPtr for the context, what happens to the values when the context is destroyed? Does the value keep a reference of the context and the context won't be destroyed until all values are garbage collected? Or will the context be destroyed and the value will be in an invalid state, referencing an invalid context?
>
>
> On 18:24, Mon, Nov 28, 2016 Geoffrey Garen <ggaren at apple.com <mailto:ggaren at apple.com>> wrote:
>> 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?
>>
>
> Values on the stack are garbage collected. If you store a reference to a value in the heap, you need to call JSValueProtect/JSValueUnprotect.
>
> Geoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/jsc-dev/attachments/20161128/db1aede5/attachment.html>
More information about the jsc-dev
mailing list