From 2016060111230ce56d2f8bad5afa448ca3e5d2a5 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 11 May 2018 00:25:59 -0400 Subject: [PATCH] async_wrap: fix memory leak in AsyncResource Reset the persistent that keeps the resource Object alive when the AsyncResource is being destroyed. Fixes: https://github.com/nodejs/node-addon-api/issues/237 --- src/node.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node.h b/src/node.h index 23e2e9995ce209..847148818abaea 100644 --- a/src/node.h +++ b/src/node.h @@ -714,6 +714,7 @@ class AsyncResource { ~AsyncResource() { EmitAsyncDestroy(isolate_, async_context_); + resource_.Reset(); } v8::MaybeLocal MakeCallback(