summaryrefslogtreecommitdiff
path: root/src/static_vars.cc
diff options
context:
space:
mode:
authorcsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2011-10-18 20:57:45 +0000
committercsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2011-10-18 20:57:45 +0000
commita6076edd177d59e67207753b799ce047a3663cb0 (patch)
tree5b3bce7c1fbc9277d82d62379000acbf32374a73 /src/static_vars.cc
parentc2eedce2a718913ed6264ac8e96571c233761e3b (diff)
downloadgperftools-a6076edd177d59e67207753b799ce047a3663cb0.tar.gz
* Get the deallocation stack trace outside the lock (sean)
* Make PageHeap dynamically allocated for leak checks (maxim) * BUGFIX: Fix probing of nm -f behavior in pprof (dpeng) * PORTING: Add "support" for MIPS cycletimer * BUGFIX: Fix a race with the CentralFreeList lock (sanjay) * Allow us to compile on OS X 10.6 and run on 10.5 (raltherr) * Support /pprof/censusprofile url arguments (rajatjain) * Die in configure when g++ is't installed (csilvers) * Change IgnoreObject to return its argument (nlewycky) * Update malloc-hook files to support more CPUs * Move stack trace collecting out of the mutex (taylorc) * BUGFIX: write our own strstr to avoid libc problems (csilvers) * use simple callgrind compression facility in pprof * print an error message when we can't run pprof to symbolize (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@120 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/static_vars.cc')
-rw-r--r--src/static_vars.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/static_vars.cc b/src/static_vars.cc
index 2ca132e..6fc852a 100644
--- a/src/static_vars.cc
+++ b/src/static_vars.cc
@@ -34,6 +34,7 @@
#include <stddef.h> // for NULL
#include <new> // for operator new
#include "internal_logging.h" // for CHECK_CONDITION
+#include "common.h"
#include "sampler.h" // for Sampler
namespace tcmalloc {
@@ -46,7 +47,7 @@ PageHeapAllocator<StackTrace> Static::stacktrace_allocator_;
Span Static::sampled_objects_;
PageHeapAllocator<StackTraceTable::Bucket> Static::bucket_allocator_;
StackTrace* Static::growth_stacks_ = NULL;
-char Static::pageheap_memory_[sizeof(PageHeap)];
+PageHeap* Static::pageheap_ = NULL;
void Static::InitStaticVars() {
sizemap_.Init();
@@ -60,7 +61,11 @@ void Static::InitStaticVars() {
for (int i = 0; i < kNumClasses; ++i) {
central_cache_[i].Init(i);
}
- new ((void*)pageheap_memory_) PageHeap;
+ // It's important to have PageHeap allocated, not in static storage,
+ // so that HeapLeakChecker does not consider all the byte patterns stored
+ // in is caches as pointers that are sources of heap object liveness,
+ // which leads to it missing some memory leaks.
+ pageheap_ = new (MetaDataAlloc(sizeof(PageHeap))) PageHeap;
DLL_Init(&sampled_objects_);
Sampler::InitStatics();
}