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 |
619 virtual void SetMemoryReleaseRate(double rate) { | 624 virtual void SetMemoryReleaseRate(double rate) { |
620 FLAGS_tcmalloc_release_rate = rate; | 625 FLAGS_tcmalloc_release_rate = rate; |
621 } | 626 } |
622 | 627 |
623 virtual double GetMemoryReleaseRate() { | 628 virtual double GetMemoryReleaseRate() { |
624 return FLAGS_tcmalloc_release_rate; | 629 return FLAGS_tcmalloc_release_rate; |
625 } | 630 } |
626 virtual size_t GetEstimatedAllocatedSize(size_t size) { | 631 virtual size_t GetEstimatedAllocatedSize(size_t size) { |
627 if (size <= kMaxSize) { | 632 if (size <= kMaxSize) { |
628 const size_t cl = Static::sizemap()->SizeClass(size); | 633 const size_t cl = Static::sizemap()->SizeClass(size); |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 static void *MemalignOverride(size_t align, size_t size, const void *caller) | 1289 static void *MemalignOverride(size_t align, size_t size, const void *caller) |
1285 __THROW ATTRIBUTE_SECTION(google_malloc); | 1290 __THROW ATTRIBUTE_SECTION(google_malloc); |
1286 | 1291 |
1287 static void *MemalignOverride(size_t align, size_t size, const void *caller) | 1292 static void *MemalignOverride(size_t align, size_t size, const void *caller) |
1288 __THROW { | 1293 __THROW { |
1289 void* result = do_memalign(align, size); | 1294 void* result = do_memalign(align, size); |
1290 MallocHook::InvokeNewHook(result, size); | 1295 MallocHook::InvokeNewHook(result, size); |
1291 return result; | 1296 return result; |
1292 } | 1297 } |
1293 void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride; | 1298 void *(*__memalign_hook)(size_t, size_t, const void *) = MemalignOverride; |
OLD | NEW |