diff options
author | Aliaksey Kandratsenka <alk@tut.by> | 2013-08-04 18:35:55 +0300 |
---|---|---|
committer | Aliaksey Kandratsenka <alk@tut.by> | 2013-08-04 18:52:28 +0300 |
commit | d76cfa6d6ca5944d6300765fcb9160e889423750 (patch) | |
tree | fcd4da808477950fae4814dea6adf5b9cbbc585b /src/heap-checker.cc | |
parent | 89b163a0883d40a612331ed8565b8ab1219fdbd0 (diff) | |
download | gperftools-d76cfa6d6ca5944d6300765fcb9160e889423750.tar.gz |
issue-502: Count m(un)map for each stacktrace in MemoryRegionMap
..instead of HeapProfileTable
This upstreams chromium commit reviewed at:
https://codereview.chromium.org/12388070
Original and upstreaming author is: Dai MIKURUBE
This patch fixes a bug that gperftools(TCMalloc)'s mmap profiler
(HEAP_PROFILE_MMAP) doesn't hook some memory pages used by the
profiler itself.
This problem has been lived in gperftools for a long time.
It is discussed in gperftools' issue 502.
https://code.google.com/p/gperftools/issues/detail?id=502
Some bugs in the mmap profiler were fixed by
https://code.google.com/p/gperftools/issues/detail?id=383,
but the patch in the issue 383 didn't fix the bug mentioned in
the issue 502.
This change reverts the previous patch and http://crrev.com/132771
at first. Then, it modifies MemoryRegionMap to count m(un)map
calls for each stacktrace in itself instead of merging the counts
for each stacktrace in HeapProfileTable.
This change also cleans up heap-profiler, heap-profile-table and
deep-heap-profile.
Chromium-BUG=https://code.google.com/p/chromium/issues/detail?id=181517
Chromium-Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=188176
Diffstat (limited to 'src/heap-checker.cc')
-rw-r--r-- | src/heap-checker.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/heap-checker.cc b/src/heap-checker.cc index c050866..040a33e 100644 --- a/src/heap-checker.cc +++ b/src/heap-checker.cc @@ -2206,13 +2206,14 @@ void HeapLeakChecker::BeforeConstructorsLocked() { RAW_CHECK(MallocHook::AddNewHook(&NewHook), ""); RAW_CHECK(MallocHook::AddDeleteHook(&DeleteHook), ""); constructor_heap_profiling = true; - MemoryRegionMap::Init(1); + MemoryRegionMap::Init(1, /* use_buckets */ false); // Set up MemoryRegionMap with (at least) one caller stack frame to record // (important that it's done before HeapProfileTable creation below). Allocator::Init(); RAW_CHECK(heap_profile == NULL, ""); heap_profile = new(Allocator::Allocate(sizeof(HeapProfileTable))) - HeapProfileTable(&Allocator::Allocate, &Allocator::Free); + HeapProfileTable(&Allocator::Allocate, &Allocator::Free, + /* profile_mmap */ false); RAW_VLOG(10, "Starting tracking the heap"); heap_checker_on = true; } |