Skip to content
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

Merged
merged 3 commits into from
Jan 9, 2019

Conversation

chenxm
Copy link
Contributor

@chenxm chenxm commented Jan 3, 2019

Description:

Related issue (if exists):

@rxjs-bot
Copy link

rxjs-bot commented Jan 3, 2019

Warnings
⚠️

commit message does not follows conventional change log (1)

(1) : RxJS uses conventional change log to generate changelog automatically. It seems some of commit messages are not following those, please check contributing guideline and update commit messages.

Generated by 🚫 dangerJS

Copy link
Collaborator

@cartant cartant left a 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;
  }
}

@coveralls
Copy link

coveralls commented Jan 3, 2019

Pull Request Test Coverage Report for Build 7852

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.2%) to 96.806%

Totals Coverage Status
Change from base Build 7837: -0.2%
Covered Lines: 5244
Relevant Lines: 5417

💛 - Coveralls

Copy link
Collaborator

@cartant cartant left a comment

Choose a reason for hiding this comment

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

See comment above.

@benlesh
Copy link
Member

benlesh commented Jan 7, 2019

I agree. @cartant, I made the changes, and also added cleaning of the errorObject.e reference on subsequent tryCatcher calls. Please review.

@@ -3,11 +3,15 @@ import { errorObject } from './errorObject';
let tryCatchTarget: Function;

function tryCatcher(this: any): any {
let result;
Copy link
Collaborator

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.

Copy link
Collaborator

@cartant cartant left a comment

Choose a reason for hiding this comment

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

LGTM

@benlesh benlesh merged commit 9e90db1 into ReactiveX:master Jan 9, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Feb 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants