From 402e356e82c08debd079744c953e3472c1174d09 Mon Sep 17 00:00:00 2001 From: "kasperl@chromium.org" Date: Mon, 30 Nov 2009 07:57:32 +0000 Subject: [PATCH] Clear the compilation cache just before starting to do mark-sweep garbage collections when receiving idle notifications. This allows us to get rid of source code strings and generated code in the heap that would otherwise be kept around in idle V8 instances. Review URL: http://codereview.chromium.org/450007 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3375 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/heap.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/heap.cc b/src/heap.cc index 4e3e6a3f86..034a744fbb 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -2901,6 +2901,11 @@ bool Heap::IdleNotification() { last_gc_count = gc_count_; } else if (number_idle_notifications == kIdlesBeforeMarkSweep) { + // Before doing the mark-sweep collections we clear the + // compilation cache to avoid hanging on to source code and + // generated code for cached functions. + CompilationCache::Clear(); + CollectAllGarbage(false); new_space_.Shrink(); last_gc_count = gc_count_;