Fix three ~Isolate() related memory leaks
authorjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 18 Aug 2011 12:14:12 +0000 (12:14 +0000)
committerjkummerow@chromium.org <jkummerow@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 18 Aug 2011 12:14:12 +0000 (12:14 +0000)
BUG=93253
TEST=running valgrind on cctest/test-api/RunTwoIsolatesOnSingleThread reports fewer leaks than before

Review URL: http://codereview.chromium.org/7624043

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8967 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/api.h
src/isolate.cc

index ce39d63..07723cb 100644 (file)
--- a/src/api.h
+++ b/src/api.h
@@ -406,6 +406,10 @@ class HandleScopeImplementer {
         spare_(NULL),
         call_depth_(0) { }
 
+  ~HandleScopeImplementer() {
+    DeleteArray(spare_);
+  }
+
   // Threading support for handle data.
   static int ArchiveSpacePerThread();
   char* RestoreThread(char* from);
index eae812b..e0dfea8 100644 (file)
@@ -1335,6 +1335,7 @@ void Isolate::ThreadDataTable::Remove(PerIsolateThreadData* data) {
   if (list_ == data) list_ = data->next_;
   if (data->next_ != NULL) data->next_->prev_ = data->prev_;
   if (data->prev_ != NULL) data->prev_->next_ = data->next_;
+  delete data;
 }
 
 
@@ -1536,6 +1537,9 @@ Isolate::~Isolate() {
   // Has to be called while counters_ are still alive.
   zone_.DeleteKeptSegment();
 
+  delete[] assembler_spare_buffer_;
+  assembler_spare_buffer_ = NULL;
+
   delete unicode_cache_;
   unicode_cache_ = NULL;