Bug 173110 - [Cocoa] JSWrapperMap leaks for all JSContexts
Summary: [Cocoa] JSWrapperMap leaks for all JSContexts
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-06-08 14:17 PDT by Joseph Pecoraro
Modified: 2017-06-08 15:24 PDT (History)
9 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (1.37 KB, patch)
2017-06-08 14:23 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2017-06-08 14:17:26 PDT
Summary:
JSWrapperMap leaks for all JSContexts

Test:

    /*
     * shell> xcrun clang -framework Foundation -framework JavaScriptCore js-leak.m
     */

    #import <Foundation/Foundation.h>
    #import <JavaScriptCore/JavaScriptCore.h>

    int main() {
        @autoreleasepool {
            [[[JSContext alloc] init] autorelease];
        }
        [[NSRunLoop mainRunLoop] run];
        return 0;
    }

Steps to Reproduce:
1. $ xcrun clang -framework Foundation -framework JavaScriptCore js-leak.m
2. $ MallocStackLogging=1 DYLD_FRAMEWORK_PATH=$build/Release ./a.out
3. $ leaks `pidof a.out`
  => Leaks

Leak:
Leak: 0x7f9b18100ce0  size=32  zone: DefaultMallocZone_0x10ecb8000   JSWrapperMap  ObjC  JavaScriptCore
	0x0e58d0f5 0x001d8001 0x181008d0 0x00007f9b 	..X.............
	0x186125c0 0x00007f9b 0x18100ec0 0x00007f9b 	.%a.............
	Call stack: [thread 0x7fffb956e3c0]: 
        | start 
        | main 
        | -[JSContext initWithVirtualMachine:] JSContext.mm:79 
        | -[JSContext ensureWrapperMap] JSContext.mm:57 
        | _objc_rootAlloc 
        | class_createInstance 
        | calloc
Comment 1 Joseph Pecoraro 2017-06-08 14:17:40 PDT
<rdar://problem/32602198>
Comment 2 Joseph Pecoraro 2017-06-08 14:23:42 PDT
Created attachment 312342 [details]
[PATCH] Proposed Fix
Comment 3 Geoffrey Garen 2017-06-08 14:48:03 PDT
Comment on attachment 312342 [details]
[PATCH] Proposed Fix

r=me
Comment 4 WebKit Commit Bot 2017-06-08 15:24:14 PDT
Comment on attachment 312342 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 312342

Committed r217952: <http://trac.webkit.org/changeset/217952>
Comment 5 WebKit Commit Bot 2017-06-08 15:24:16 PDT
All reviewed patches have been landed.  Closing bug.