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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13646 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2013-02-12 11:57:51 +00:00
parent 2fb5064487
commit 9eec096914
6 changed files with 20 additions and 0 deletions

View File

@ -1378,6 +1378,7 @@ void Shell::OnExit() {
"-------------+\n");
delete [] counters;
}
delete context_mutex_;
delete counters_file_;
delete counter_map_;
#endif // V8_SHARED

View File

@ -1548,6 +1548,14 @@ Isolate::ThreadDataTable::ThreadDataTable()
}
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*
Isolate::ThreadDataTable::Lookup(Isolate* isolate,
ThreadId thread_id) {
@ -1735,6 +1743,11 @@ void Isolate::TearDown() {
}
void Isolate::GlobalTearDown() {
delete thread_data_table_;
}
void Isolate::Deinit() {
if (state_ == INITIALIZED) {
TRACE_ISOLATE(deinit);

View File

@ -470,6 +470,8 @@ class Isolate {
// 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

View File

@ -115,6 +115,7 @@ void V8::TearDown() {
LOperand::TearDownCaches();
ExternalReference::TearDownMathExpData();
RegisteredExtension::UnregisterAll();
Isolate::GlobalTearDown();
is_running_ = false;
has_been_disposed_ = true;

View File

@ -16422,6 +16422,7 @@ TEST(IsolateDifferentContexts) {
CHECK(v->IsNumber());
CHECK_EQ(22, static_cast<int>(v->NumberValue()));
}
isolate->Dispose();
}
class InitDefaultIsolateThread : public v8::internal::Thread {

View File

@ -289,6 +289,7 @@ TEST(IsolateNestedLocking) {
threads.Add(new IsolateNestedLockingThread(isolate));
}
StartJoinAndDeleteThreads(threads);
isolate->Dispose();
}
@ -584,6 +585,7 @@ TEST(LockUnlockLockMultithreaded) {
threads.Add(new LockUnlockLockThread(isolate, context));
}
StartJoinAndDeleteThreads(threads);
isolate->Dispose();
}
class LockUnlockLockDefaultIsolateThread : public JoinableThread {