mirror of
https://github.com/gperftools/gperftools
synced 2024-12-21 23:09:57 +00:00
undo MarkThreadTemporarilyIdle and make it same as MarkThreadIdle
As noted on github issue #880 'temporarily' thing saves us not just on freeing thread cache, but also returning thread's share of thread cache (max_size_) into common pool. And the later has caused trouble to mongo folk who originally proposed 'temporarily' thing. They claim they don't use it anymore. And thus with no users and no clear benefit, it makes no sense for us to keep this API. For API and ABI compat sake we keep it, but it is now identical to regular MarkThreadIdle. Fixes issue #880
This commit is contained in:
parent
c3059a56be
commit
8b3f0d6145
@ -411,10 +411,8 @@ class PERFTOOLS_DLL_DECL MallocExtension {
|
||||
// Returns the size in bytes of the calling threads cache.
|
||||
virtual size_t GetThreadCacheSize();
|
||||
|
||||
// Like MarkThreadIdle, but does not destroy the internal data
|
||||
// structures of the thread cache. When the thread resumes, it wil
|
||||
// have an empty cache but will not need to pay to reconstruct the
|
||||
// cache data structures.
|
||||
// Note, as of gperftools 3.11 it is identical to
|
||||
// MarkThreadIdle. See github issue #880
|
||||
virtual void MarkThreadTemporarilyIdle();
|
||||
};
|
||||
|
||||
|
@ -656,10 +656,6 @@ class TCMallocImplementation : public MallocExtension {
|
||||
return tc->Size();
|
||||
}
|
||||
|
||||
virtual void MarkThreadTemporarilyIdle() {
|
||||
ThreadCache::BecomeTemporarilyIdle();
|
||||
}
|
||||
|
||||
virtual void Ranges(void* arg, RangeFunction func) {
|
||||
IterateOverRanges(arg, func);
|
||||
}
|
||||
@ -836,6 +832,18 @@ class TCMallocImplementation : public MallocExtension {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Note, in gperftools 2.5 we introduced this 'ligher-weight'
|
||||
// equivalent of MarkThreadIdle, but as of now mongo folk tells us
|
||||
// they don't use it anymore. And there was indeed possible issue
|
||||
// with this approach since it didn't 'return' thread's share of
|
||||
// total thread cache back to common pool. But that was almost
|
||||
// exactly the difference between regular mark idle and mark
|
||||
// "temporarily" idle. So we now go back to original mark idle, but
|
||||
// keep API for ABI and API compat sake.
|
||||
virtual void MarkThreadTemporarilyIdle() {
|
||||
MarkThreadIdle();
|
||||
}
|
||||
|
||||
virtual void MarkThreadIdle() {
|
||||
ThreadCache::BecomeIdle();
|
||||
}
|
||||
|
@ -451,12 +451,6 @@ void ThreadCache::BecomeIdle() {
|
||||
DeleteCache(heap);
|
||||
}
|
||||
|
||||
void ThreadCache::BecomeTemporarilyIdle() {
|
||||
ThreadCache* heap = GetCacheIfPresent();
|
||||
if (heap)
|
||||
heap->Cleanup();
|
||||
}
|
||||
|
||||
void ThreadCache::DestroyThreadCache(void* ptr) {
|
||||
// Note that "ptr" cannot be NULL since pthread promises not
|
||||
// to invoke the destructor on NULL values, but for safety,
|
||||
|
@ -109,7 +109,6 @@ class ThreadCache {
|
||||
static ThreadCache* GetFastPathCache();
|
||||
static ThreadCache* CreateCacheIfNecessary();
|
||||
static void BecomeIdle();
|
||||
static void BecomeTemporarilyIdle();
|
||||
static void SetUseEmergencyMalloc();
|
||||
static void ResetUseEmergencyMalloc();
|
||||
static bool IsUseEmergencyMalloc();
|
||||
|
Loading…
Reference in New Issue
Block a user