From 3e54b5cbb02cc27692f1920af7f514e95b77adb9 Mon Sep 17 00:00:00 2001 From: "mikhail.naganov@gmail.com" Date: Tue, 4 May 2010 14:30:22 +0000 Subject: [PATCH] Do a GC pass prior to collecting a heap profile. It seems that doing an extra GC pass results in less cluttered heap snapshots. Review URL: http://codereview.chromium.org/1949001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4580 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api.cc b/src/api.cc index 85c21fb178..4709a156b4 100644 --- a/src/api.cc +++ b/src/api.cc @@ -3646,6 +3646,8 @@ void V8::ResumeProfilerEx(int flags, int tag) { // those modules which haven't been started prior to making a // snapshot. + // Make a GC prior to taking a snapshot. + i::Heap::CollectAllGarbage(false); // Reset snapshot flag and CPU module flags. flags &= ~(PROFILER_MODULE_HEAP_SNAPSHOT | PROFILER_MODULE_CPU); const int current_flags = i::Logger::GetActiveProfilerModules();