Summary: Leaks bot always reports "WebKit Malloc Memory Pressure Handler" as leaking This seems like a valid report of a leak, however logically it doesn't appear to be a leak. We should be able to silence the report by saving the source into a member variable or static variable. For example, WebKit::WebMemoryPressureHandler uses a member variable. Steps to Reproduce: 1. run-webkit-tests --leaks <one-test> => Leaks Leaks: Leak: 0x7feb425074c0 size=128 zone: DefaultMallocZone_0x10dff3000 OS_dispatch_queue ObjC libdispatch.dylib "WebKit Malloc Memory Pressure Handler" (from JavaScriptCore) Call stack: [thread 0x7fffb0c013c0]: | start | main main.mm:66 | WTR::TestController::TestController(int, char const**) TestController.cpp:123 | WTR::TestController::TestController(int, char const**) TestController.cpp:117 | WTR::WebNotificationProvider::WebNotificationProvider() WebNotificationProvider.cpp:65 | WTR::WebNotificationProvider::WebNotificationProvider() WebNotificationProvider.cpp:63 | WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::HashMap() HashMap.h:76 | WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::HashMap() HashMap.h:76 | WTF::HashTable<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::KeyValuePairTraits, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> > >::HashTable() HashTable.h:559 | WTF::HashTable<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::KeyValuePairTraits, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> > >::HashTable() HashTable.h:553 | WTF::Lock::operator new(unsigned long) Lock.h:135 | WTF::fastMalloc(unsigned long) FastMalloc.cpp:256 | bmalloc::api::malloc(unsigned long) bmalloc.h:43 | bmalloc::Cache::allocate(unsigned long) Cache.h:79 | bmalloc::Cache::allocateSlowCaseNullCache(unsigned long) Cache.cpp:66 | bmalloc::PerThread<bmalloc::Cache>::getSlowCase() PerThread.h:141 | bmalloc::Cache::Cache() Cache.cpp:57 | bmalloc::Cache::Cache() PerProcess.h:84 | bmalloc::PerProcess<bmalloc::Heap>::getSlowCase() PerProcess.h:93 | bmalloc::Heap::Heap(std::__1::lock_guard<bmalloc::StaticMutex>&) Heap.cpp:63 | bmalloc::Heap::Heap(std::__1::lock_guard<bmalloc::StaticMutex>&) Heap.cpp:56 | _dispatch_queue_create_with_target | _os_object_alloc_realized | class_createInstance | calloc Leak: 0x7feb42507540 size=176 zone: DefaultMallocZone_0x10dff3000 OS_dispatch_source ObjC libdispatch.dylib 0xb0bd0348 0x00007fff 0x00000001 0x00000000 H............... 0x89abcdef 0xffffffff 0x425074c0 0x00007feb .........tPB.... 0x00000000 0x00000000 0x00000000 0x00000000 ................ 0x00000000 0x00000000 0x00000000 0x000fffe0 ................ 0x00000044 0x00000000 0xa7c86856 0x00007fff D.......Vh...... 0xffffffff 0xffffffff 0x00000000 0x00000000 ................ 0x00000000 0x00000000 0x00000000 0x00000000 ................ 0x00012000 0x00000000 0x00000000 0x0000002c . ..........,... ... Call stack: [thread 0x7fffb0c013c0]: | start | main main.mm:66 | WTR::TestController::TestController(int, char const**) TestController.cpp:123 | WTR::TestController::TestController(int, char const**) TestController.cpp:117 | WTR::WebNotificationProvider::WebNotificationProvider() WebNotificationProvider.cpp:65 | WTR::WebNotificationProvider::WebNotificationProvider() WebNotificationProvider.cpp:63 | WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::HashMap() HashMap.h:76 | WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::HashMap() HashMap.h:76 | WTF::HashTable<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::KeyValuePairTraits, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> > >::HashTable() HashTable.h:559 | WTF::HashTable<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > >, WTF::KeyValuePairKeyExtractor<WTF::KeyValuePair<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashMap<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*>, WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> >, WTF::PtrHash<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> >, WTF::HashTraits<WTF::HashSet<unsigned long long, WTF::IntHash<unsigned long long>, WTF::HashTraits<unsigned long long> > > >::KeyValuePairTraits, WTF::HashTraits<WebKit::WKRetainPtr<OpaqueWKNotificationManager const*> > >::HashTable() HashTable.h:553 | WTF::Lock::operator new(unsigned long) Lock.h:135 | WTF::fastMalloc(unsigned long) FastMalloc.cpp:256 | bmalloc::api::malloc(unsigned long) bmalloc.h:43 | bmalloc::Cache::allocate(unsigned long) Cache.h:79 | bmalloc::Cache::allocateSlowCaseNullCache(unsigned long) Cache.cpp:66 | bmalloc::PerThread<bmalloc::Cache>::getSlowCase() PerThread.h:141 | bmalloc::Cache::Cache() Cache.cpp:57 | bmalloc::Cache::Cache() PerProcess.h:84 | bmalloc::PerProcess<bmalloc::Heap>::getSlowCase() PerProcess.h:93 | bmalloc::Heap::Heap(std::__1::lock_guard<bmalloc::StaticMutex>&) Heap.cpp:63 | bmalloc::Heap::Heap(std::__1::lock_guard<bmalloc::StaticMutex>&) Heap.cpp:57 | dispatch_source_create | _os_object_alloc_realized | class_createInstance | calloc
Yeah we leak it on purpose :(. I guess we can add a dummy data member for it just to silence the leaks bot.
Created attachment 309225 [details] [PATCH] Proposed Fix
Comment on attachment 309225 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=309225&action=review r=me > Source/bmalloc/bmalloc/Heap.cpp:61 > + dispatch_resume(m_pressureHandlerDispatchSource); I guess you should dispatch_release queue here, since we're behaving as if we're not leaking these objects.
Created attachment 309240 [details] [PATCH] For landing
Comment on attachment 309240 [details] [PATCH] For landing Clearing flags on attachment: 309240 Committed r216300: <http://trac.webkit.org/changeset/216300>