Skip to content

Commit

Permalink
async_wrap: fix memory leak in AsyncResource
Browse files Browse the repository at this point in the history
Reset the persistent that keeps the resource
Object alive when the AsyncResource is being
destroyed.

Fixes: nodejs/node-addon-api#237

PR-URL: #20668
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Gabriel Schulhof <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
mhdawson authored and MylesBorins committed Jul 9, 2018
1 parent 6eec3fc commit d7d5f11
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ class AsyncResource {

virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_);
resource_.Reset();
}

v8::MaybeLocal<v8::Value> MakeCallback(
Expand Down

0 comments on commit d7d5f11

Please sign in to comment.