Title: [110748] trunk/Source/_javascript_Core
Revision
110748
Author
[email protected]
Date
2012-03-14 14:14:16 -0700 (Wed, 14 Mar 2012)

Log Message

Heap::destroy leaks CopiedSpace
https://bugs.webkit.org/show_bug.cgi?id=81055

Reviewed by Geoffrey Garen.

Added a destroy() function to CopiedSpace that moves all normal size 
CopiedBlocks from the CopiedSpace to the Heap's list of free blocks 
as well as deallocates all of the oversize blocks in the CopiedSpace. 
This function is now called in Heap::destroy().

* heap/CopiedSpace.cpp:
(JSC::CopiedSpace::destroy):
(JSC):
* heap/CopiedSpace.h:
(CopiedSpace):
* heap/Heap.cpp:
(JSC::Heap::destroy):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (110747 => 110748)


--- trunk/Source/_javascript_Core/ChangeLog	2012-03-14 21:10:24 UTC (rev 110747)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-03-14 21:14:16 UTC (rev 110748)
@@ -1,3 +1,23 @@
+2012-03-14  Mark Hahnenberg  <[email protected]>
+
+        Heap::destroy leaks CopiedSpace
+        https://bugs.webkit.org/show_bug.cgi?id=81055
+
+        Reviewed by Geoffrey Garen.
+
+        Added a destroy() function to CopiedSpace that moves all normal size 
+        CopiedBlocks from the CopiedSpace to the Heap's list of free blocks 
+        as well as deallocates all of the oversize blocks in the CopiedSpace. 
+        This function is now called in Heap::destroy().
+
+        * heap/CopiedSpace.cpp:
+        (JSC::CopiedSpace::destroy):
+        (JSC):
+        * heap/CopiedSpace.h:
+        (CopiedSpace):
+        * heap/Heap.cpp:
+        (JSC::Heap::destroy):
+
 2012-03-14  Andrew Lo  <[email protected]>
 
         [BlackBerry] Implement REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR using AnimationFrameRateController

Modified: trunk/Source/_javascript_Core/heap/CopiedSpace.cpp (110747 => 110748)


--- trunk/Source/_javascript_Core/heap/CopiedSpace.cpp	2012-03-14 21:10:24 UTC (rev 110747)
+++ trunk/Source/_javascript_Core/heap/CopiedSpace.cpp	2012-03-14 21:14:16 UTC (rev 110748)
@@ -261,4 +261,26 @@
     return true;
 }
 
+void CopiedSpace::destroy()
+{
+    while (!m_toSpace->isEmpty()) {
+        CopiedBlock* block = static_cast<CopiedBlock*>(m_toSpace->removeHead());
+        MutexLocker locker(m_heap->m_freeBlockLock);
+        m_heap->m_freeBlocks.append(block);
+        m_heap->m_numberOfFreeBlocks++;
+    }
+
+    while (!m_fromSpace->isEmpty()) {
+        CopiedBlock* block = static_cast<CopiedBlock*>(m_fromSpace->removeHead());
+        MutexLocker locker(m_heap->m_freeBlockLock);
+        m_heap->m_freeBlocks.append(block);
+        m_heap->m_numberOfFreeBlocks++;
+    }
+
+    while (!m_oversizeBlocks.isEmpty()) {
+        CopiedBlock* block = static_cast<CopiedBlock*>(m_oversizeBlocks.removeHead());
+        block->m_allocation.deallocate();
+    }
+}
+
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/heap/CopiedSpace.h (110747 => 110748)


--- trunk/Source/_javascript_Core/heap/CopiedSpace.h	2012-03-14 21:10:24 UTC (rev 110747)
+++ trunk/Source/_javascript_Core/heap/CopiedSpace.h	2012-03-14 21:14:16 UTC (rev 110748)
@@ -68,6 +68,8 @@
     size_t totalMemoryAllocated() { return m_totalMemoryAllocated; }
     size_t totalMemoryUtilized() { return m_totalMemoryUtilized; }
 
+    void destroy();
+
     static CopiedBlock* blockFor(void*);
 
 private:

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (110747 => 110748)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2012-03-14 21:10:24 UTC (rev 110747)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2012-03-14 21:14:16 UTC (rev 110748)
@@ -379,8 +379,9 @@
     m_handleHeap.finalizeWeakHandles();
     m_globalData->smallStrings.finalizeSmallStrings();
     shrink();
+    m_storageSpace.destroy();
     ASSERT(!size());
-    
+
 #if ENABLE(SIMPLE_HEAP_PROFILING)
     m_slotVisitor.m_visitedTypeCounts.dump(WTF::dataFile(), "Visited Type Counts");
     m_destroyedTypeCounts.dump(WTF::dataFile(), "Destroyed Type Counts");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to