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:
parent
2fb5064487
commit
9eec096914
@ -1378,6 +1378,7 @@ void Shell::OnExit() {
|
|||||||
"-------------+\n");
|
"-------------+\n");
|
||||||
delete [] counters;
|
delete [] counters;
|
||||||
}
|
}
|
||||||
|
delete context_mutex_;
|
||||||
delete counters_file_;
|
delete counters_file_;
|
||||||
delete counter_map_;
|
delete counter_map_;
|
||||||
#endif // V8_SHARED
|
#endif // V8_SHARED
|
||||||
|
@ -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::PerIsolateThreadData*
|
||||||
Isolate::ThreadDataTable::Lookup(Isolate* isolate,
|
Isolate::ThreadDataTable::Lookup(Isolate* isolate,
|
||||||
ThreadId thread_id) {
|
ThreadId thread_id) {
|
||||||
@ -1735,6 +1743,11 @@ void Isolate::TearDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Isolate::GlobalTearDown() {
|
||||||
|
delete thread_data_table_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Isolate::Deinit() {
|
void Isolate::Deinit() {
|
||||||
if (state_ == INITIALIZED) {
|
if (state_ == INITIALIZED) {
|
||||||
TRACE_ISOLATE(deinit);
|
TRACE_ISOLATE(deinit);
|
||||||
|
@ -470,6 +470,8 @@ class Isolate {
|
|||||||
// for legacy API reasons.
|
// for legacy API reasons.
|
||||||
void TearDown();
|
void TearDown();
|
||||||
|
|
||||||
|
static void GlobalTearDown();
|
||||||
|
|
||||||
bool IsDefaultIsolate() const { return this == default_isolate_; }
|
bool IsDefaultIsolate() const { return this == default_isolate_; }
|
||||||
|
|
||||||
// Ensures that process-wide resources and the default isolate have been
|
// Ensures that process-wide resources and the default isolate have been
|
||||||
|
@ -115,6 +115,7 @@ void V8::TearDown() {
|
|||||||
LOperand::TearDownCaches();
|
LOperand::TearDownCaches();
|
||||||
ExternalReference::TearDownMathExpData();
|
ExternalReference::TearDownMathExpData();
|
||||||
RegisteredExtension::UnregisterAll();
|
RegisteredExtension::UnregisterAll();
|
||||||
|
Isolate::GlobalTearDown();
|
||||||
|
|
||||||
is_running_ = false;
|
is_running_ = false;
|
||||||
has_been_disposed_ = true;
|
has_been_disposed_ = true;
|
||||||
|
@ -16422,6 +16422,7 @@ TEST(IsolateDifferentContexts) {
|
|||||||
CHECK(v->IsNumber());
|
CHECK(v->IsNumber());
|
||||||
CHECK_EQ(22, static_cast<int>(v->NumberValue()));
|
CHECK_EQ(22, static_cast<int>(v->NumberValue()));
|
||||||
}
|
}
|
||||||
|
isolate->Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
class InitDefaultIsolateThread : public v8::internal::Thread {
|
class InitDefaultIsolateThread : public v8::internal::Thread {
|
||||||
|
@ -289,6 +289,7 @@ TEST(IsolateNestedLocking) {
|
|||||||
threads.Add(new IsolateNestedLockingThread(isolate));
|
threads.Add(new IsolateNestedLockingThread(isolate));
|
||||||
}
|
}
|
||||||
StartJoinAndDeleteThreads(threads);
|
StartJoinAndDeleteThreads(threads);
|
||||||
|
isolate->Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -584,6 +585,7 @@ TEST(LockUnlockLockMultithreaded) {
|
|||||||
threads.Add(new LockUnlockLockThread(isolate, context));
|
threads.Add(new LockUnlockLockThread(isolate, context));
|
||||||
}
|
}
|
||||||
StartJoinAndDeleteThreads(threads);
|
StartJoinAndDeleteThreads(threads);
|
||||||
|
isolate->Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
class LockUnlockLockDefaultIsolateThread : public JoinableThread {
|
class LockUnlockLockDefaultIsolateThread : public JoinableThread {
|
||||||
|
Loading…
Reference in New Issue
Block a user