Skip to content

Conversation

@artynet
Copy link
Contributor

@artynet artynet commented Oct 30, 2019

The replacement is safe and it is strongly advised according the new https://github.com/nodejs/nan APIs

https://github.com/nodejs/nan/blob/master/doc/node_misc.md#api_nan_asyncresource

@WeiAnAn was definitely right in making this crucial modification

}

Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(m->callback), 1, args);
Nan::AsyncResource *asyncResource = new Nan::AsyncResource("callback");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a clean change ... but my question is what is calling delete on asyncResource ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without delete we might have a memory leak.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you 100% sure that the new NAN APIs and node 12 won't take care of it ? do you have some sort of setup to run some tests....or at least tell me how to do it ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could test it by running the code in debug mode and with valgrind to check for memory leaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants