Changeset 153636 in webkit


Ignore:
Timestamp:
Aug 1, 2013 11:09:05 PM (11 years ago)
Author:
mrowe@apple.com
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.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r153635 r153636  
     12013-08-01  Mark Rowe  <mrowe@apple.com>
     2
     3        <rdar://problem/14235491> FastMalloc zone enumerator responding to MALLOC_PTR_REGION_RANGE_TYPE with individual allocations
     4
     5        Teach PageMapMemoryUsageRecorder::recordPendingRegions to only record data of the type that it's asked for.
     6        This also fixes the vmmap output to associate some regions with the FastMalloc malloc zone that were previously
     7        associated with it only via the VM tag, meaning they were incorrectly being omitted from the malloc statistics
     8        section of the report.
     9
     10        Reviewed by Dan Bernstein.
     11
     12        * wtf/FastMalloc.cpp:
     13        (WTF::PageMapMemoryUsageRecorder::recordPendingRegions): Report the individual allocations only when requested. Add
     14        the ability to report the regions containing pointers separately from the allocations.
     15
    1162013-08-01  Mark Rowe  <mrowe@apple.com>
    217
  • trunk/Source/WTF/wtf/FastMalloc.cpp

    r153455 r153636  
    48504850    void recordPendingRegions()
    48514851    {
    4852         if (!(m_typeMask & (MALLOC_PTR_IN_USE_RANGE_TYPE | MALLOC_PTR_REGION_RANGE_TYPE))) {
     4852        bool recordRegionsContainingPointers = m_typeMask & MALLOC_PTR_REGION_RANGE_TYPE;
     4853        bool recordAllocations = m_typeMask & MALLOC_PTR_IN_USE_RANGE_TYPE;
     4854
     4855        if (!recordRegionsContainingPointers && !recordAllocations) {
    48534856            m_coalescedSpans.clear();
    48544857            return;
    48554858        }
    48564859
     4860        Vector<vm_range_t, 256> pointerRegions;
    48574861        Vector<vm_range_t, 1024> allocatedPointers;
    48584862        for (size_t i = 0; i < m_coalescedSpans.size(); ++i) {
    48594863            Span *theSpan = m_coalescedSpans[i];
    4860             if (theSpan->free)
    4861                 continue;
    4862 
    48634864            vm_address_t spanStartAddress = theSpan->start << kPageShift;
    48644865            vm_size_t spanSizeInBytes = theSpan->length * kPageSize;
     4866
     4867            if (recordRegionsContainingPointers)
     4868                pointerRegions.append((vm_range_t){spanStartAddress, spanSizeInBytes});
     4869
     4870            if (theSpan->free || !recordAllocations)
     4871                continue;
    48654872
    48664873            if (!theSpan->sizeclass) {
     
    48804887        }
    48814888
    4882         (*m_recorder)(m_task, m_context, m_typeMask & (MALLOC_PTR_IN_USE_RANGE_TYPE | MALLOC_PTR_REGION_RANGE_TYPE), allocatedPointers.data(), allocatedPointers.size());
     4889        if (recordRegionsContainingPointers)
     4890            (*m_recorder)(m_task, m_context, MALLOC_PTR_REGION_RANGE_TYPE, pointerRegions.data(), pointerRegions.size());
     4891
     4892        if (recordAllocations)
     4893            (*m_recorder)(m_task, m_context, MALLOC_PTR_IN_USE_RANGE_TYPE, allocatedPointers.data(), allocatedPointers.size());
    48834894
    48844895        m_coalescedSpans.clear();
Note: See TracChangeset for help on using the changeset viewer.