Changeset 252661 in webkit


Ignore:
Timestamp:
Nov 19, 2019 4:56:39 PM (5 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Work-around Leaks' false-positive report about memory leaking
https://bugs.webkit.org/show_bug.cgi?id=204384
<rdar://problem/56950932>

Reviewed by Mark Lam.

According to the radar, Leaks start reporting false-positive memory leaks about ExecutableAllocator and FixedVMPoolExecutableAllocator,
while they are per-process singleton and reachable through g_jscConfig. I'm guessing this is because Leaks start skipping scan for
readonly memory region. (g_jscConfig is now mprotected to readonly).

To work-around this, we anchor these heap allocated things to global variables to help Leaks scan. Once it is fixed, we should remove it.

  • jit/ExecutableAllocator.cpp:

(JSC::ExecutableAllocator::initializeUnderlyingAllocator):
(JSC::ExecutableAllocator::initialize):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r252618 r252661  
     12019-11-19  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Work-around Leaks' false-positive report about memory leaking
     4        https://bugs.webkit.org/show_bug.cgi?id=204384
     5        <rdar://problem/56950932>
     6
     7        Reviewed by Mark Lam.
     8
     9        According to the radar, Leaks start reporting false-positive memory leaks about ExecutableAllocator and FixedVMPoolExecutableAllocator,
     10        while they are per-process singleton and reachable through g_jscConfig. I'm guessing this is because Leaks start skipping scan for
     11        readonly memory region. (g_jscConfig is now mprotected to readonly).
     12
     13        To work-around this, we anchor these heap allocated things to global variables to help Leaks scan. Once it is fixed, we should remove it.
     14
     15        * jit/ExecutableAllocator.cpp:
     16        (JSC::ExecutableAllocator::initializeUnderlyingAllocator):
     17        (JSC::ExecutableAllocator::initialize):
     18
    1192019-11-18  Mark Lam  <mark.lam@apple.com>
    220
  • trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp

    r250383 r252661  
    415415}
    416416
     417// Keep this pointer in a mutable global variable to help Leaks find it.
     418// But we do not use this pointer.
     419static FixedVMPoolExecutableAllocator* globalFixedVMPoolExecutableAllocatorToWorkAroundLeaks = nullptr;
    417420void ExecutableAllocator::initializeUnderlyingAllocator()
    418421{
    419422    RELEASE_ASSERT(!g_jscConfig.fixedVMPoolExecutableAllocator);
    420423    g_jscConfig.fixedVMPoolExecutableAllocator = new FixedVMPoolExecutableAllocator();
     424    globalFixedVMPoolExecutableAllocatorToWorkAroundLeaks = g_jscConfig.fixedVMPoolExecutableAllocator;
    421425    CodeProfiling::notifyAllocator(g_jscConfig.fixedVMPoolExecutableAllocator);
    422426}
     
    643647namespace JSC {
    644648
     649// Keep this pointer in a mutable global variable to help Leaks find it.
     650// But we do not use this pointer.
     651static ExecutableAllocator* globalExecutableAllocatorToWorkAroundLeaks = nullptr;
    645652void ExecutableAllocator::initialize()
    646653{
    647654    g_jscConfig.executableAllocator = new ExecutableAllocator;
     655    globalExecutableAllocatorToWorkAroundLeaks = g_jscConfig.executableAllocator;
    648656}
    649657
Note: See TracChangeset for help on using the changeset viewer.