| Index: third_party/tcmalloc/chromium/src/heap-profile-table.h
|
| diff --git a/third_party/tcmalloc/chromium/src/heap-profile-table.h b/third_party/tcmalloc/chromium/src/heap-profile-table.h
|
| index 61493fc3013cabd73f3b4ca94838e2ffe828fb07..eeb36463489ffcd6175848c0d1e82bbfd9544d6a 100644
|
| --- a/third_party/tcmalloc/chromium/src/heap-profile-table.h
|
| +++ b/third_party/tcmalloc/chromium/src/heap-profile-table.h
|
| @@ -138,6 +138,12 @@ class HeapProfileTable {
|
| // are skipped in heap checking reports.
|
| void MarkAsIgnored(const void* ptr);
|
|
|
| + // Mark all currently known allocations as "ignored".
|
| + void MarkAllAsIgnored();
|
| +
|
| + // Mark all currently known, but not "ignored" allocations as "live".
|
| + void MarkAllAsLive();
|
| +
|
| // Return current total (de)allocation statistics. It doesn't contain
|
| // mmap'ed regions.
|
| const Stats& total() const { return total_; }
|
| @@ -203,6 +209,21 @@ class HeapProfileTable {
|
| // calling ClearMMapData.
|
| void ClearMMapData();
|
|
|
| + // Dump a list of allocations marked as "live" along with their creation
|
| + // stack traces and sizes to a file named |file_name|. Together with
|
| + // MarkAllAsIgnored and MarkAllAsLive this can be used to find objects that
|
| + // are created in a certain time span:
|
| + // 1. Invoke MarkAllAsIgnored to mark the start of the timespan. All known
|
| + // allocations are marked as "ignored" now.
|
| + // 2. Perform whatever action you suspect allocates memory that is not
|
| + // correctly freed.
|
| + // 3. Invoke MarkAllAsLive. New allocations are now marked as "live".
|
| + // 4. Perform whatever action is supposed to free the memory again. New
|
| + // allocations are not marked. So all allocations that are marked as
|
| + // "live" where created during step 2.
|
| + // 5. Invoke DumpLiveObjects to get the list of "live" allocations.
|
| + void DumpLiveObjects(const char* file_name);
|
| +
|
| private:
|
| friend class DeepHeapProfile;
|
|
|
| @@ -307,11 +328,25 @@ class HeapProfileTable {
|
| callback(ptr, info);
|
| }
|
|
|
| + // Helper for MarkAllAsIgnored and MarkAllAsLive
|
| + static void MarkAllIterator(const void* ptr, AllocValue* v,
|
| + bool mark_as_ignored) {
|
| + if (mark_as_ignored)
|
| + v->set_ignore(true);
|
| + else if (!v->ignore())
|
| + v->set_live(true);
|
| + }
|
| +
|
| // Helper for DumpNonLiveProfile to do object-granularity
|
| // heap profile dumping. It gets passed to AllocationMap::Iterate.
|
| inline static void DumpNonLiveIterator(const void* ptr, AllocValue* v,
|
| const DumpArgs& args);
|
|
|
| + // Helper for DumpLiveObjects to dump all "live" allocations. It gets passed
|
| + // to AllocationMap::Iterate.
|
| + inline static void DumpLiveIterator(const void* ptr, AllocValue* v,
|
| + const DumpArgs& args);
|
| +
|
| // Helper for filling size variables in buckets by zero.
|
| inline static void ZeroBucketCountsIterator(
|
| const void* ptr, AllocValue* v, HeapProfileTable* heap_profile);
|
|
|