Revision: 13646
Author:   [email protected]
Date:     Tue Feb 12 03:57:51 2013
Log:      Fixed a memory leak in v8 and another one in d8.

Cleaned up a few tests on the way. This CL brings us down to 5 leaks for d8.

Review URL: https://codereview.chromium.org/12223089
http://code.google.com/p/v8/source/detail?r=13646

Modified:
 /branches/bleeding_edge/src/d8.cc
 /branches/bleeding_edge/src/isolate.cc
 /branches/bleeding_edge/src/isolate.h
 /branches/bleeding_edge/src/v8.cc
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/test/cctest/test-lockers.cc

=======================================
--- /branches/bleeding_edge/src/d8.cc   Tue Feb 12 00:59:53 2013
+++ /branches/bleeding_edge/src/d8.cc   Tue Feb 12 03:57:51 2013
@@ -1378,6 +1378,7 @@
            "-------------+\n");
     delete [] counters;
   }
+  delete context_mutex_;
   delete counters_file_;
   delete counter_map_;
 #endif  // V8_SHARED
=======================================
--- /branches/bleeding_edge/src/isolate.cc      Tue Feb  5 00:09:32 2013
+++ /branches/bleeding_edge/src/isolate.cc      Tue Feb 12 03:57:51 2013
@@ -1546,6 +1546,14 @@
 Isolate::ThreadDataTable::ThreadDataTable()
     : list_(NULL) {
 }
+
+
+Isolate::ThreadDataTable::~ThreadDataTable() {
+  // TODO(svenpanne) The assertion below would fire if an embedder does not
+ // cleanly dispose all Isolates before disposing v8, so we are conservative
+  // and leave it out for now.
+  // ASSERT_EQ(NULL, list_);
+}


 Isolate::PerIsolateThreadData*
@@ -1733,6 +1741,11 @@
   // Restore the previous current isolate.
   SetIsolateThreadLocals(saved_isolate, saved_data);
 }
+
+
+void Isolate::GlobalTearDown() {
+  delete thread_data_table_;
+}


 void Isolate::Deinit() {
=======================================
--- /branches/bleeding_edge/src/isolate.h       Thu Jan 31 06:23:36 2013
+++ /branches/bleeding_edge/src/isolate.h       Tue Feb 12 03:57:51 2013
@@ -470,6 +470,8 @@
   // for legacy API reasons.
   void TearDown();

+  static void GlobalTearDown();
+
   bool IsDefaultIsolate() const { return this == default_isolate_; }

   // Ensures that process-wide resources and the default isolate have been
=======================================
--- /branches/bleeding_edge/src/v8.cc   Mon Jan 21 04:04:40 2013
+++ /branches/bleeding_edge/src/v8.cc   Tue Feb 12 03:57:51 2013
@@ -115,6 +115,7 @@
   LOperand::TearDownCaches();
   ExternalReference::TearDownMathExpData();
   RegisteredExtension::UnregisterAll();
+  Isolate::GlobalTearDown();

   is_running_ = false;
   has_been_disposed_ = true;
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc     Mon Feb 11 05:02:20 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc     Tue Feb 12 03:57:51 2013
@@ -16422,6 +16422,7 @@
     CHECK(v->IsNumber());
     CHECK_EQ(22, static_cast<int>(v->NumberValue()));
   }
+  isolate->Dispose();
 }

 class InitDefaultIsolateThread : public v8::internal::Thread {
=======================================
--- /branches/bleeding_edge/test/cctest/test-lockers.cc Fri Jan 25 00:31:46 2013 +++ /branches/bleeding_edge/test/cctest/test-lockers.cc Tue Feb 12 03:57:51 2013
@@ -289,6 +289,7 @@
     threads.Add(new IsolateNestedLockingThread(isolate));
   }
   StartJoinAndDeleteThreads(threads);
+  isolate->Dispose();
 }


@@ -584,6 +585,7 @@
     threads.Add(new LockUnlockLockThread(isolate, context));
   }
   StartJoinAndDeleteThreads(threads);
+  isolate->Dispose();
 }

 class LockUnlockLockDefaultIsolateThread : public JoinableThread {

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to