Ignore:
Timestamp:
Mar 12, 2009, 8:33:27 PM (16 years ago)
Author:
[email protected]
Message:

<rdar://problem/6548446> TCMalloc_SystemRelease should use madvise rather than re-mmaping span of pages

  • wtf/FastMalloc.cpp:

(WTF::mergeDecommittedStates): If either of the spans has been released to the system, release the other
span as well so that the flag in the merged span is accurate.

  • wtf/Platform.h:
  • wtf/TCSystemAlloc.cpp: Track decommitted spans when using MADV_FREE_REUSABLE / MADV_FREE_REUSE.

(TCMalloc_SystemRelease): Use madvise with MADV_FREE_REUSABLE when it is available.
(TCMalloc_SystemCommit): Use madvise with MADV_FREE_REUSE when it is available.

  • wtf/TCSystemAlloc.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/FastMalloc.cpp

    r41443 r41660  
    9595#endif
    9696
    97 #define TCMALLOC_TRACK_DECOMMITED_SPANS (HAVE(VIRTUALALLOC))
     97#define TCMALLOC_TRACK_DECOMMITED_SPANS (HAVE(VIRTUALALLOC) || HAVE(MADV_FREE_REUSE))
    9898
    9999#ifndef NDEBUG
     
    14041404static ALWAYS_INLINE void mergeDecommittedStates(Span* destination, Span* other)
    14051405{
    1406     if (other->decommitted)
     1406    if (destination->decommitted && !other->decommitted) {
     1407        TCMalloc_SystemRelease(reinterpret_cast<void*>(other->start << kPageShift),
     1408                               static_cast<size_t>(other->length << kPageShift));
     1409    } else if (other->decommitted && !destination->decommitted) {
     1410        TCMalloc_SystemRelease(reinterpret_cast<void*>(destination->start << kPageShift),
     1411                               static_cast<size_t>(destination->length << kPageShift));
    14071412        destination->decommitted = true;
     1413    }
    14081414}
    14091415#endif
Note: See TracChangeset for help on using the changeset viewer.