Title: [252661] trunk/Source/_javascript_Core
Revision
252661
Author
ysuz...@apple.com
Date
2019-11-19 16:56:39 -0800 (Tue, 19 Nov 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (252660 => 252661)


--- trunk/Source/_javascript_Core/ChangeLog	2019-11-20 00:50:51 UTC (rev 252660)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-11-20 00:56:39 UTC (rev 252661)
@@ -1,3 +1,21 @@
+2019-11-19  Yusuke Suzuki  <ysuz...@apple.com>
+
+        [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):
+
 2019-11-18  Mark Lam  <mark....@apple.com>
 
         Always enable Optional<OptionsStorage::Size> parse(const char* string) for OS(DARWIN).

Modified: trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp (252660 => 252661)


--- trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2019-11-20 00:50:51 UTC (rev 252660)
+++ trunk/Source/_javascript_Core/jit/ExecutableAllocator.cpp	2019-11-20 00:56:39 UTC (rev 252661)
@@ -414,10 +414,14 @@
     m_reservation.deallocate();
 }
 
+// Keep this pointer in a mutable global variable to help Leaks find it.
+// But we do not use this pointer.
+static FixedVMPoolExecutableAllocator* globalFixedVMPoolExecutableAllocatorToWorkAroundLeaks = nullptr;
 void ExecutableAllocator::initializeUnderlyingAllocator()
 {
     RELEASE_ASSERT(!g_jscConfig.fixedVMPoolExecutableAllocator);
     g_jscConfig.fixedVMPoolExecutableAllocator = new FixedVMPoolExecutableAllocator();
+    globalFixedVMPoolExecutableAllocatorToWorkAroundLeaks = g_jscConfig.fixedVMPoolExecutableAllocator;
     CodeProfiling::notifyAllocator(g_jscConfig.fixedVMPoolExecutableAllocator);
 }
 
@@ -642,9 +646,13 @@
 
 namespace JSC {
 
+// Keep this pointer in a mutable global variable to help Leaks find it.
+// But we do not use this pointer.
+static ExecutableAllocator* globalExecutableAllocatorToWorkAroundLeaks = nullptr;
 void ExecutableAllocator::initialize()
 {
     g_jscConfig.executableAllocator = new ExecutableAllocator;
+    globalExecutableAllocatorToWorkAroundLeaks = g_jscConfig.executableAllocator;
 }
 
 ExecutableAllocator& ExecutableAllocator::singleton()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to