Reviewers: Vitaly,

Description:
[Isolates] Fix memory leaks in Isolate and Logger.

This fixes following bugs:
http://code.google.com/p/v8/issues/detail?id=1035
http://code.google.com/p/v8/issues/detail?id=1036

Please review this at http://codereview.chromium.org/6347005/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/isolates

Affected files:
  M src/isolate.cc
  M src/log.h
  M src/log.cc


Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index ce2ff4d720310e952451e309645a1a585e2b2aa8..49b005ab388c292515aa37f8a18b90c4137c63a2 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -499,6 +499,11 @@ Isolate::~Isolate() {
   delete cpu_features_;
   cpu_features_ = NULL;

+  delete handle_scope_implementer_;
+  handle_scope_implementer_ = NULL;
+  delete break_access_;
+  break_access_ = NULL;
+
   delete compilation_cache_;
   compilation_cache_ = NULL;
   delete bootstrapper_;
@@ -585,11 +590,6 @@ bool Isolate::PreInit() {
   regexp_stack_ = new RegExpStack();
   regexp_stack_->isolate_ = this;

-#ifdef ENABLE_DEBUGGER_SUPPORT
-  debugger_ = new Debugger();
-  debugger_->isolate_ = this;
-#endif
-
 #ifdef ENABLE_LOGGING_AND_PROFILING
   producer_heap_profile_ = new ProducerHeapProfile();
   producer_heap_profile_->isolate_ = this;
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index bd2823adb7835a6094cca564a551657fc4e389f5..fa6fe24234d835b900d3baf8b4d7c91088880955 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -348,6 +348,10 @@ Logger::Logger()
     prev_code_(NULL) {
 }

+Logger::~Logger() {
+  delete log_;
+}
+
 #define DECLARE_LONG_EVENT(ignore1, long_name, ignore2) long_name,
static const char* const kLongLogEventsNames[Logger::NUMBER_OF_LOG_EVENTS] = {
   LOG_EVENTS_AND_TAGS_LIST(DECLARE_LONG_EVENT)
Index: src/log.h
diff --git a/src/log.h b/src/log.h
index 0791fb9e4dbb30e44322fd3ea74580aa235fb195..a889079a4efe7df4b22117434f8d29244f13e73c 100644
--- a/src/log.h
+++ b/src/log.h
@@ -297,6 +297,7 @@ class Logger {

  private:
   Logger();
+  ~Logger();

   // Size of window used for log records compression.
   static const int kCompressionWindowSize = 4;


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to