summaryrefslogtreecommitdiff
path: root/src/heap-checker-bcad.cc
diff options
context:
space:
mode:
authorcsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2011-03-21 21:41:55 +0000
committercsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2011-03-21 21:41:55 +0000
commit1d30e525ae6ac38ae381bb3118f7f47998af2942 (patch)
treea8349a4801e90c96515f3c0329a5a6c1813fc27f /src/heap-checker-bcad.cc
parent6fe07cd2c0527e18276cc79a57e2212a4b048746 (diff)
downloadgperftools-1d30e525ae6ac38ae381bb3118f7f47998af2942.tar.gz
* Improve debugallocation tc_malloc_size (csilvers)
* Extend atomicops.h to use ARM V6+ optimized code (sanek) * Fix failure in Ranges test (ppluzhnikov) * Change malloc-hook to use a list-like structure (llib) * Update tcmalloc_regtest to use new malloc hooks (llib) * PARTIAL: Keep track of 'overhead' bytes in the page cache (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@108 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/heap-checker-bcad.cc')
-rw-r--r--src/heap-checker-bcad.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/heap-checker-bcad.cc b/src/heap-checker-bcad.cc
index 87d3d87..82a3109 100644
--- a/src/heap-checker-bcad.cc
+++ b/src/heap-checker-bcad.cc
@@ -51,7 +51,6 @@
// sure this file is not optimized out by the linker.
bool heap_leak_checker_bcad_variable;
-extern void HeapLeakChecker_BeforeConstructors(); // in heap-checker.cc
extern void HeapLeakChecker_AfterDestructors(); // in heap-checker.cc
// A helper class to ensure that some components of heap leak checking
@@ -61,7 +60,12 @@ class HeapLeakCheckerGlobalPrePost {
public:
HeapLeakCheckerGlobalPrePost() {
if (count_ == 0) {
- HeapLeakChecker_BeforeConstructors();
+ // The 'new int' will ensure that we have run an initial malloc
+ // hook, which will set up the heap checker via
+ // MallocHook_InitAtFirstAllocation_HeapLeakChecker. See malloc_hook.cc.
+ // This is done in this roundabout fashion in order to avoid self-deadlock
+ // if we directly called HeapLeakChecker_BeforeConstructors here.
+ delete new int;
// This needs to be called before the first allocation of an STL
// object, but after libc is done setting up threads (because it
// calls setenv, which requires a thread-aware errno). By