bmalloc: Fixed a leak in the per-thread cache
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Apr 2014 00:23:38 +0000 (00:23 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Apr 2014 00:23:38 +0000 (00:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131330

Reviewed by Andreas Kling.

Remember to deallocate our line caches upon thread exit.

* bmalloc/Deallocator.cpp:
(bmalloc::Deallocator::~Deallocator):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@166898 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc/Deallocator.cpp

index f52e5f12834f2345d2309b9e2e02b76595477719..6fa75b0368675780fc26892c30a8fa75ddb94a5f 100644 (file)
@@ -1,3 +1,15 @@
+2014-04-07  Geoffrey Garen  <ggaren@apple.com>
+
+        bmalloc: Fixed a leak in the per-thread cache
+        https://bugs.webkit.org/show_bug.cgi?id=131330
+
+        Reviewed by Andreas Kling.
+
+        Remember to deallocate our line caches upon thread exit.
+
+        * bmalloc/Deallocator.cpp:
+        (bmalloc::Deallocator::~Deallocator):
+
 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
 
         bmalloc: rolled out the tryLock experiment
 2014-04-07  Geoffrey Garen  <ggaren@apple.com>
 
         bmalloc: rolled out the tryLock experiment
index 69d634408d60fb1101c18a7971af6490ad3dc2b7..ff511b685884d9a374e2abd5fd52c4a48752c462 100644 (file)
@@ -47,8 +47,15 @@ Deallocator::Deallocator()
 
 Deallocator::~Deallocator()
 {
 
 Deallocator::~Deallocator()
 {
-    std::lock_guard<Mutex> lock(PerProcess<Heap>::mutex());
     processObjectLog();
     processObjectLog();
+    
+    std::lock_guard<Mutex> lock(PerProcess<Heap>::mutex());
+    Heap* heap = PerProcess<Heap>::getFastCase();
+    
+    while (m_smallLineCache.size())
+        heap->deallocateSmallLine(lock, m_smallLineCache.pop());
+    while (m_mediumLineCache.size())
+        heap->deallocateMediumLine(lock, m_mediumLineCache.pop());
 }
 
 void Deallocator::deallocateLarge(void* object)
 }
 
 void Deallocator::deallocateLarge(void* object)