Title: [216300] trunk/Source/bmalloc
Revision
216300
Author
[email protected]
Date
2017-05-05 17:24:11 -0700 (Fri, 05 May 2017)

Log Message

Leaks always reports "WebKit Malloc Memory Pressure Handler" dispatch_queue/source as leaking
https://bugs.webkit.org/show_bug.cgi?id=171532

Patch by Joseph Pecoraro <[email protected]> on 2017-05-05
Reviewed by Geoffrey Garen.

* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
* bmalloc/Heap.h:
Store the dispatch_source_t in a member to avoid a false positive leak.

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (216299 => 216300)


--- trunk/Source/bmalloc/ChangeLog	2017-05-06 00:17:00 UTC (rev 216299)
+++ trunk/Source/bmalloc/ChangeLog	2017-05-06 00:24:11 UTC (rev 216300)
@@ -1,3 +1,15 @@
+2017-05-05  Joseph Pecoraro  <[email protected]>
+
+        Leaks always reports "WebKit Malloc Memory Pressure Handler" dispatch_queue/source as leaking
+        https://bugs.webkit.org/show_bug.cgi?id=171532
+
+        Reviewed by Geoffrey Garen.
+
+        * bmalloc/Heap.cpp:
+        (bmalloc::Heap::Heap):
+        * bmalloc/Heap.h:
+        Store the dispatch_source_t in a member to avoid a false positive leak.
+
 2017-04-27  Michael Saboff  <[email protected]>
 
         bmalloc scavenger should know what page classes are allocating

Modified: trunk/Source/bmalloc/bmalloc/Heap.cpp (216299 => 216300)


--- trunk/Source/bmalloc/bmalloc/Heap.cpp	2017-05-06 00:17:00 UTC (rev 216299)
+++ trunk/Source/bmalloc/bmalloc/Heap.cpp	2017-05-06 00:24:11 UTC (rev 216300)
@@ -30,11 +30,11 @@
 #include "PerProcess.h"
 #include "SmallLine.h"
 #include "SmallPage.h"
+#include <thread>
+
 #if BOS(DARWIN)
 #include "bmalloc.h"
-#include <dispatch/dispatch.h>
 #endif
-#include <thread>
 
 namespace bmalloc {
 
@@ -54,11 +54,12 @@
 
 #if BOS(DARWIN)
     auto queue = dispatch_queue_create("WebKit Malloc Memory Pressure Handler", DISPATCH_QUEUE_SERIAL);
-    auto source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_CRITICAL, queue);
-    dispatch_source_set_event_handler(source, ^{
+    m_pressureHandlerDispatchSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_CRITICAL, queue);
+    dispatch_source_set_event_handler(m_pressureHandlerDispatchSource, ^{
         api::scavenge();
     });
-    dispatch_resume(source);
+    dispatch_resume(m_pressureHandlerDispatchSource);
+    dispatch_release(queue);
 #endif
 }
 

Modified: trunk/Source/bmalloc/bmalloc/Heap.h (216299 => 216300)


--- trunk/Source/bmalloc/bmalloc/Heap.h	2017-05-06 00:17:00 UTC (rev 216299)
+++ trunk/Source/bmalloc/bmalloc/Heap.h	2017-05-06 00:24:11 UTC (rev 216300)
@@ -42,6 +42,10 @@
 #include <array>
 #include <mutex>
 
+#if BOS(DARWIN)
+#include <dispatch/dispatch.h>
+#endif
+
 namespace bmalloc {
 
 class BeginTag;
@@ -128,6 +132,7 @@
     VMHeap m_vmHeap;
 
 #if BOS(DARWIN)
+    dispatch_source_t m_pressureHandlerDispatchSource;
     qos_class_t m_requestedScavengerThreadQOSClass { QOS_CLASS_UNSPECIFIED };
 #endif
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to