Reviewers: Jakob,

Description:
Fix some memory leaks in debugger and d8.

%DebugPromiseHandlePrologue expects to be followed up by %..Epilogue,
otherwise we get a leak.
[email protected]

Please review this at https://codereview.chromium.org/301553002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+4, -0 lines):
  M src/d8.cc
  M src/debug.cc


Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index ffc58e6478377f592210946e292b1a72d9337dfe..a2f1f3382d2f000f9ac90d909d2318a6446dc49c 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -1089,6 +1089,7 @@ void Shell::ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args) {
   isolate->AdjustAmountOfExternalAllocatedMemory(length);

   args.GetReturnValue().Set(buffer);
+  delete data;
 }


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 0af63f61fdcd63ea3731250c6726d6bf9da46fed..25c600ad8da7523a3e87e3825412b2c80eaa86b5 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -813,6 +813,9 @@ void Debug::Unload() {
   // Clear the script cache.
   DestroyScriptCache();

+  // Match unmatched PromiseHandlePrologue calls.
+  while (thread_local_.promise_on_stack_) PromiseHandleEpilogue();
+
   // Clear debugger context global handle.
   GlobalHandles::Destroy(Handle<Object>::cast(debug_context_).location());
   debug_context_ = Handle<Context>();


--
--
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/d/optout.

Reply via email to