Title: [153636] trunk/Source/WTF
Revision
153636
Author
[email protected]
Date
2013-08-01 23:09:05 -0700 (Thu, 01 Aug 2013)

Log Message

<rdar://problem/14235491> FastMalloc zone enumerator responding to MALLOC_PTR_REGION_RANGE_TYPE with individual allocations

Teach PageMapMemoryUsageRecorder::recordPendingRegions to only record data of the type that it's asked for.
This also fixes the vmmap output to associate some regions with the FastMalloc malloc zone that were previously
associated with it only via the VM tag, meaning they were incorrectly being omitted from the malloc statistics
section of the report.

Reviewed by Dan Bernstein.

* wtf/FastMalloc.cpp:
(WTF::PageMapMemoryUsageRecorder::recordPendingRegions): Report the individual allocations only when requested. Add
the ability to report the regions containing pointers separately from the allocations.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (153635 => 153636)


--- trunk/Source/WTF/ChangeLog	2013-08-02 06:01:54 UTC (rev 153635)
+++ trunk/Source/WTF/ChangeLog	2013-08-02 06:09:05 UTC (rev 153636)
@@ -1,5 +1,20 @@
 2013-08-01  Mark Rowe  <[email protected]>
 
+        <rdar://problem/14235491> FastMalloc zone enumerator responding to MALLOC_PTR_REGION_RANGE_TYPE with individual allocations
+
+        Teach PageMapMemoryUsageRecorder::recordPendingRegions to only record data of the type that it's asked for.
+        This also fixes the vmmap output to associate some regions with the FastMalloc malloc zone that were previously
+        associated with it only via the VM tag, meaning they were incorrectly being omitted from the malloc statistics
+        section of the report.
+
+        Reviewed by Dan Bernstein.
+
+        * wtf/FastMalloc.cpp:
+        (WTF::PageMapMemoryUsageRecorder::recordPendingRegions): Report the individual allocations only when requested. Add
+        the ability to report the regions containing pointers separately from the allocations.
+
+2013-08-01  Mark Rowe  <[email protected]>
+
         <rdar://problem/14528244> False-positive leaks from FastMalloc.
 
         A logic error in the page map enumeration code within FastMalloc could result in a subset of the memory regions

Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (153635 => 153636)


--- trunk/Source/WTF/wtf/FastMalloc.cpp	2013-08-02 06:01:54 UTC (rev 153635)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp	2013-08-02 06:09:05 UTC (rev 153636)
@@ -4849,20 +4849,27 @@
 
     void recordPendingRegions()
     {
-        if (!(m_typeMask & (MALLOC_PTR_IN_USE_RANGE_TYPE | MALLOC_PTR_REGION_RANGE_TYPE))) {
+        bool recordRegionsContainingPointers = m_typeMask & MALLOC_PTR_REGION_RANGE_TYPE;
+        bool recordAllocations = m_typeMask & MALLOC_PTR_IN_USE_RANGE_TYPE;
+
+        if (!recordRegionsContainingPointers && !recordAllocations) {
             m_coalescedSpans.clear();
             return;
         }
 
+        Vector<vm_range_t, 256> pointerRegions;
         Vector<vm_range_t, 1024> allocatedPointers;
         for (size_t i = 0; i < m_coalescedSpans.size(); ++i) {
             Span *theSpan = m_coalescedSpans[i];
-            if (theSpan->free)
-                continue;
-
             vm_address_t spanStartAddress = theSpan->start << kPageShift;
             vm_size_t spanSizeInBytes = theSpan->length * kPageSize;
 
+            if (recordRegionsContainingPointers)
+                pointerRegions.append((vm_range_t){spanStartAddress, spanSizeInBytes});
+
+            if (theSpan->free || !recordAllocations)
+                continue;
+
             if (!theSpan->sizeclass) {
                 // If it's an allocated large object span, mark it as in use
                 if (!m_freeObjectFinder.isFreeObject(spanStartAddress))
@@ -4879,8 +4886,12 @@
             }
         }
 
-        (*m_recorder)(m_task, m_context, m_typeMask & (MALLOC_PTR_IN_USE_RANGE_TYPE | MALLOC_PTR_REGION_RANGE_TYPE), allocatedPointers.data(), allocatedPointers.size());
+        if (recordRegionsContainingPointers)
+            (*m_recorder)(m_task, m_context, MALLOC_PTR_REGION_RANGE_TYPE, pointerRegions.data(), pointerRegions.size());
 
+        if (recordAllocations)
+            (*m_recorder)(m_task, m_context, MALLOC_PTR_IN_USE_RANGE_TYPE, allocatedPointers.data(), allocatedPointers.size());
+
         m_coalescedSpans.clear();
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to