From f25220b2cfae015709afb68824f6442a2c9f2bef Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 3 Dec 2018 14:22:26 -0500 Subject: Fix test_cc memory leaks. These were discovered using the LSAN. http://dev.chromium.org/developers/testing/leaksanitizer --- libdeno/api.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'libdeno/api.cc') diff --git a/libdeno/api.cc b/libdeno/api.cc index c059bb534..eac6bdb61 100644 --- a/libdeno/api.cc +++ b/libdeno/api.cc @@ -16,8 +16,7 @@ extern "C" { Deno* deno_new(deno_buf snapshot, deno_buf shared, deno_recv_cb cb) { deno::DenoIsolate* d = new deno::DenoIsolate(snapshot, cb, shared); v8::Isolate::CreateParams params; - params.array_buffer_allocator = - v8::ArrayBuffer::Allocator::NewDefaultAllocator(); + params.array_buffer_allocator = d->array_buffer_allocator_; params.external_references = deno::external_references; if (snapshot.data_ptr) { @@ -55,8 +54,9 @@ Deno* deno_new_snapshotter(deno_buf shared, deno_recv_cb cb, auto* d = new deno::DenoIsolate(deno::empty_buf, cb, shared); d->snapshot_creator_ = creator; d->AddIsolate(isolate); - v8::Isolate::Scope isolate_scope(isolate); { + v8::Locker locker(isolate); + v8::Isolate::Scope isolate_scope(isolate); v8::HandleScope handle_scope(isolate); auto context = v8::Context::New(isolate); creator->SetDefaultContext(context, @@ -186,7 +186,6 @@ void deno_check_promise_errors(Deno* d_) { void deno_delete(Deno* d_) { deno::DenoIsolate* d = reinterpret_cast(d_); - d->isolate_->Dispose(); delete d; } -- cgit v1.2.3