summaryrefslogtreecommitdiffstats
path: root/gin
diff options
context:
space:
mode:
authorssid <ssid@chromium.org>2015-11-04 18:35:39 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-05 02:36:34 +0000
commitbce6ee4509c2609d347246d6f3403f2e34df95bb (patch)
tree56c466ee741a2077693f624bbe21d4b7c57e4e6a /gin
parent1f2ab3f2e1d3ce0407df6e0337411ce5bad52a4c (diff)
downloadchromium_src-bce6ee4509c2609d347246d6f3403f2e34df95bb.zip
chromium_src-bce6ee4509c2609d347246d6f3403f2e34df95bb.tar.gz
chromium_src-bce6ee4509c2609d347246d6f3403f2e34df95bb.tar.bz2
[tracing] Fix the total size of V8 for debug mode
V8 makes resident all the memory it mmaps, filling it with 0xdeadbeef for debug. But the dump provider only displays the live memory as total, while it is supposed to display the resident size. This CL fixes this to display correct resident size depending on the zapping. BUG=546492 Review URL: https://codereview.chromium.org/1427513002 Cr-Commit-Position: refs/heads/master@{#357989}
Diffstat (limited to 'gin')
-rw-r--r--gin/v8_isolate_memory_dump_provider.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gin/v8_isolate_memory_dump_provider.cc b/gin/v8_isolate_memory_dump_provider.cc
index 79c7177..55e6c50 100644
--- a/gin/v8_isolate_memory_dump_provider.cc
+++ b/gin/v8_isolate_memory_dump_provider.cc
@@ -103,6 +103,18 @@ void V8IsolateMemoryDumpProvider::DumpHeapStatistics(
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
heap_statistics.total_heap_size() - known_spaces_size);
+ // If V8 zaps garbage, all the memory mapped regions become resident,
+ // so we add an extra dump to avoid mismatches w.r.t. the total
+ // resident values.
+ if (heap_statistics.does_zap_garbage()) {
+ auto zap_dump = process_memory_dump->CreateAllocatorDump(
+ dump_base_name + "/zapped_for_debug");
+ zap_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ heap_statistics.total_heap_size() -
+ heap_statistics.total_physical_size());
+ }
+
// If light dump is requested, then object statistics are not dumped
if (args.level_of_detail == base::trace_event::MemoryDumpLevelOfDetail::LIGHT)
return;