From e61337d36dd957ec0bf0dce5398e8c2c4bd468f4 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 PR-URL: https://github.com/nodejs/node/pull/20668 Reviewed-By: Anna Henningsen Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Gabriel Schulhof Reviewed-By: James M Snell --- src/node.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node.h b/src/node.h index 5d6aa8dadfc8c4..2ac145f4f75bd9 100644 --- a/src/node.h +++ b/src/node.h @@ -714,6 +714,7 @@ class AsyncResource { virtual ~AsyncResource() { EmitAsyncDestroy(isolate_, async_context_); + resource_.Reset(); } v8::MaybeLocal MakeCallback(