Ignore:
Timestamp:
Dec 14, 2007, 4:25:45 PM (18 years ago)
Author:
[email protected]
Message:

Add logic for TCMalloc to release memory to the system

Reviewed by Maciej and Oliver.

Add final changes to make TCMalloc release memory to the system.
This results in a 0.4% regression against ToT, but this is offset
against the gains made by the original TCMalloc r38 merge - in fact
we retain around 0.3-0.4% progression overall.

File:
1 edited

Legend:

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

    r28435 r28727  
    381381}
    382382
    383 #ifndef MADV_DONTNEED
    384 void TCMalloc_SystemRelease(void*, size_t) {}
    385 #else
    386383void TCMalloc_SystemRelease(void* start, size_t length) {
     384#ifdef MADV_DONTNEED
    387385  if (FLAGS_malloc_devmem_start) {
    388386    // It's not safe to use MADV_DONTNEED if we've been mapping
     
    416414    }
    417415  }
    418 }
    419 #endif
     416#endif
     417
     418#if HAVE(MMAP)
     419  void *newAddress = mmap(start, length, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED, -1, 0);
     420  UNUSED_PARAM(newAddress);
     421  // If the mmap failed then that's ok, we just won't return the memory to the system.
     422  ASSERT(newAddress == start || newAddress == reinterpret_cast<void*>(MAP_FAILED));
     423#endif
     424}
Note: See TracChangeset for help on using the changeset viewer.