How to release a JSValueRef created by JSObjectMakeTypedArrayWithBytesNoCopy?

Hi

I use JSObjectMakeTypedArrayWithBytesNoCopy(JSContextRef ctx, JSTypedArrayType arrayType, void *bytes, size_t byteLength, JSTypedArrayBytesDeallocator bytesDeallocator, void *deallocatorContext, JSValueRef *exception) to create a JSObjectRef, and [JSValue valueWithJSValueRef: inContext:] to create a JSValue. I then pass the JSValue to the JSContext.

I have noticed that even if I don't pass the JSValue to the JSContext, the JSTypedArrayBytesDeallocator is always called after the deallocation of the JSContext. In my understanding, it should be released by the JS garbage collection when there are no references to it.

Since I have a large amount of data to pass to the JSContext, if the JSTypedArrayBytesDeallocator is called too late, it may cause memory issues. Where am I mistaken in this case?

Thanks.