OLD | NEW |
1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 | 609 |
610 virtual void MarkThreadIdle() { | 610 virtual void MarkThreadIdle() { |
611 ThreadCache::BecomeIdle(); | 611 ThreadCache::BecomeIdle(); |
612 } | 612 } |
613 | 613 |
614 virtual void ReleaseFreeMemory() { | 614 virtual void ReleaseFreeMemory() { |
615 SpinLockHolder h(Static::pageheap_lock()); | 615 SpinLockHolder h(Static::pageheap_lock()); |
616 Static::pageheap()->ReleaseFreePages(); | 616 Static::pageheap()->ReleaseFreePages(); |
617 } | 617 } |
618 | 618 |
619 virtual void Scavenge() { | |
620 SpinLockHolder h(Static::pageheap_lock()); | |
621 Static::pageheap()->Scavenge(); | |
622 } | |
623 | |
624 virtual void SetMemoryReleaseRate(double rate) { | 619 virtual void SetMemoryReleaseRate(double rate) { |
625 FLAGS_tcmalloc_release_rate = rate; | 620 FLAGS_tcmalloc_release_rate = rate; |
626 } | 621 } |
627 | 622 |
628 virtual double GetMemoryReleaseRate() { | 623 virtual double GetMemoryReleaseRate() { |
629 return FLAGS_tcmalloc_release_rate; | 624 return FLAGS_tcmalloc_release_rate; |
630 } | 625 } |
631 virtual size_t GetEstimatedAllocatedSize(size_t size) { | 626 virtual size_t GetEstimatedAllocatedSize(size_t size) { |
632 if (size <= kMaxSize) { | 627 if (size <= kMaxSize) { |
633 const size_t cl = Static::sizemap()->SizeClass(size); | 628 const size_t cl = Static::sizemap()->SizeClass(size); |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1289 static void *MemalignOverride(size_t align, size_t size, const void *caller) | 1284 static void *MemalignOverride(size_t align, size_t size, const void *caller) |
1290 __THROW ATTRIBUTE_SECTION(google_malloc); | 1285 __THROW ATTRIBUTE_SECTION(google_malloc); |
1291 | 1286 |
1292 static void *MemalignOverride(size_t align, size_t size, const void *caller) | 1287 static void *MemalignOverride(size_t align, size_t size, const void *caller) |
1293 __THROW { | 1288 __THROW { |
1294 void* result = do_memalign(align, size); | 1289 void* result = do_memalign(align, size); |
1295 MallocHook::InvokeNewHook(result, size); | 1290 MallocHook::InvokeNewHook(result, size); |
1296 return result; | 1291 return result; |
1297 } | 1292 } |
1298 void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride; | 1293 void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride; |
OLD | NEW |