Reviewers: Mads Ager, Description: Fix the last memory leak demonstrated by the test program in http://code.google.com/p/v8/issues/detail?id=444
Please review this at http://codereview.chromium.org/243027 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/api.h M src/list.h Index: src/list.h =================================================================== --- src/list.h (revision 2976) +++ src/list.h (working copy) @@ -51,6 +51,13 @@ 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); } Index: src/api.h =================================================================== --- src/api.h (revision 2977) +++ src/api.h (working copy) @@ -369,6 +369,9 @@ 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; --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
