Commit 0c8f8de9 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Fix the last memory leak demonstrated by the test program in

http://code.google.com/p/v8/issues/detail?id=444
Review URL: http://codereview.chromium.org/243027

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2978 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ae882b44
......@@ -369,6 +369,9 @@ class HandleScopeImplementer {
ASSERT(blocks_.length() == 0);
ASSERT(entered_contexts_.length() == 0);
ASSERT(saved_contexts_.length() == 0);
blocks_.Free();
entered_contexts_.Free();
saved_contexts_.Free();
if (spare_ != NULL) {
DeleteArray(spare_);
spare_ = NULL;
......
......@@ -51,6 +51,13 @@ class List {
INLINE(explicit List(int capacity)) { Initialize(capacity); }
INLINE(~List()) { DeleteData(data_); }
// Deallocates memory used by the list and leaves the list in a consistent
// empty state.
void Free() {
DeleteData(data_);
Initialize(0);
}
INLINE(void* operator new(size_t size)) { return P::New(size); }
INLINE(void operator delete(void* p, size_t)) { return P::Delete(p); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment