-
Notifications
You must be signed in to change notification settings - Fork 3k
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
clear tryCatchTarget to release reference of function for gc #4450
Conversation
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to see undefined
assigned to it in a finally
block. That would be simpler, IMO.
Like this:
function tryCatcher(this: any): any {
try {
return tryCatchTarget.apply(this, arguments);
} catch (e) {
errorObject.e = e;
return errorObject;
} finally {
tryCatchTarget = undefined;
}
}
Pull Request Test Coverage Report for Build 7852
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above.
… up errorObject.e on call.
I agree. @cartant, I made the changes, and also added cleaning of the |
src/internal/util/tryCatch.ts
Outdated
@@ -3,11 +3,15 @@ import { errorObject } from './errorObject'; | |||
let tryCatchTarget: Function; | |||
|
|||
function tryCatcher(this: any): any { | |||
let result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the changes made, result
is no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description:
Related issue (if exists):