Xcode 16 JSGlobalContextCreate memory leak

The following has a memory leak on Xcode 16.

        JSGlobalContextRef _cx = JSGlobalContextCreateInGroup(NULL, NULL);
#ifndef NDEBUG
#ifdef __IPHONE_16_4
    if (__builtin_available(iOS 16.4, *)) {
        JSGlobalContextSetInspectable(_cx, true);
    }
#endif
#endif
        JSStringRef ctxName = JSStringCreateWithUTF8CString("Xcode16");
        JSGlobalContextSetName(_cx, ctxName);
        JSStringRelease(ctxName);
        
        JSGlobalContextRelease(_cx);
Answered by itlijunjie in 804768022

Use 'JSGlobalContextCreateInGroup (NULL, NULL)' can release normally. Use 'JSGlobalContextCreate (NULL,)' can not release.

JSContext object is not released

Accepted Answer

Use 'JSGlobalContextCreateInGroup (NULL, NULL)' can release normally. Use 'JSGlobalContextCreate (NULL,)' can not release.

Xcode 16 JSGlobalContextCreate memory leak
 
 
Q