-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: remove redundant calls to HandleScope #20177
Conversation
I don’t think we can be sure that these calls are unnecessary. HandleScope handle_scope(…);
for (int i = 0; i < n; i++) {
CallbackScope callback_scope(…);
HandleScope handle_scope(…);
/* do something with Node.js objects here */
} Omitting the callback scopes here means that all of the handles allocated by the constructor/destructor (I only see 2 that I’m sure of, but it’s hard to tell just by looking at the code) would fall into the outer scope now, and would accumulate and be kept alive for as long as that loop runs. I don’t think the impact would be huge, but I would prefer to err on the side of caution and not remove these? That being said: I am not sure whether there are handle allocations inside the |
@addaleax I had been removing any calls to That said, I'm really new to all this, and I might be very wrong. Let me know if I am, I would be more than happy to take my changes back. |
@ryzokuken Yeah, and that totally makes sense for cases like #20045 where it’s obvious that the |
@addaleax you're right. That said, if all the tests pass (benchmarks included), then perhaps it wouldn't be that bad of an idea anyway, right? |
@ryzokuken Like I said, this may affect memory usage in some odd cases – The handle scopes aren’t quite as redundant as it was the case in #20045. |
Hmm. Is there a way to find out? If they aren't redundant, we should just close this. |
@ryzokuken Basically what I said above – replace them with |
Ping @ryzokuken |
@ryzokuken I think you can assume that this is not urgent in any way :) |
@addaleax It definitely isn't. I'm using PRs like these to widen my understanding of the C++ part of the codebase, tbh. Need to know internals better. |
I'm going to close this out. Adding |
Refs: #19972 (comment)
Refs: #20045
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passescc @addaleax @hashseed @nodejs/v8