aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Langlois <olivier@trillion01.com>2024-09-01 15:45:16 -0400
committerOlivier Langlois <olivier@trillion01.com>2024-09-01 15:45:16 -0400
commitf46c141b4eaea3872c2bfc3974d1240ff16dd00b (patch)
tree79bc044fba8bd3c32c6474a117e1b61cf597cfbc
parentae15d7a490eff0cd93fbbcfa89469f672e0ec7cd (diff)
downloadgoogle-perftools-f46c141b4eaea3872c2bfc3974d1240ff16dd00b.tar.gz
google-perftools-f46c141b4eaea3872c2bfc3974d1240ff16dd00b.zip
make ThreadCache constructor/destructor privateHEADmaster
1. This documents the intent that the way to create/destroy a ThreadCache object is through the static methods NewHeap()/DeleteCache() 2. It makes using the class less error prone. The compiler will complain if some new code is accidentally creating objects directly 3. This may allow some compilers to optimize code knowing that those functions are private Signed-off-by: Olivier Langlois <olivier@trillion01.com>
-rw-r--r--src/thread_cache.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/thread_cache.h b/src/thread_cache.h
index 7454688..09cfcef 100644
--- a/src/thread_cache.h
+++ b/src/thread_cache.h
@@ -69,11 +69,6 @@ class ThreadCache {
// REQUIRES: Static::pageheap_lock is not held.
static void DeleteCache(ThreadCache* heap);
- // REQUIRES: Static::pageheap_lock is held
- ThreadCache();
- // REQUIRES: Static::pageheap_lock is not held
- ~ThreadCache();
-
// Accessors (mostly just for printing stats)
int freelist_length(uint32_t cl) const { return list_[cl].length(); }
@@ -240,6 +235,11 @@ class ThreadCache {
}
};
+ // REQUIRES: Static::pageheap_lock is held
+ ThreadCache();
+ // REQUIRES: Static::pageheap_lock is not held
+ ~ThreadCache();
+
// Gets and returns an object from the central cache, and, if possible,
// also adds some objects of that size class to this thread cache.
void* FetchFromCentralCache(uint32_t cl, int32_t byte_size,