-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Fix memory leak of resolve data from ALL transitions ever
The treeChanges object has references to the PathNodes from the previous transition (`.treeChanges("from")`). The PathNode object has resolve data inside it. The previous transition is reachable via a resolve (via tokens: `"$transition$"` or `Transition`). Through this chain, all other transitions are reachable and not eligible for GC. This change cleans out the previous Transition object from the resolves, but only after a transition has been evicted from the `successfulTransitions` queue. The `successfulTransitions` queue currently has a max size of 1, so the transition is cleaned up once it is no longer the current nor previous transition (it is cleaned when it's the previous previous transition); Fixes #55 Fixes angular-ui/ui-router#3603 Fixes ui-router/angular#21
- Loading branch information
1 parent
eaff405
commit 7f2aed1
Showing
6 changed files
with
61 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7f2aed1
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.
There is any chance of it be implemented in legacy version? (angular-ui/ui-router#545)
7f2aed1
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.
@LeonanCarvalho no, because legacy version doesn't use
Transition
. This was a new bug introduced somewhere around 1.0 release.I'm not aware of any memory leaks in the legacy version
7f2aed1
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'm not sure, but at this issue angular-ui/ui-router#545 as closed, this is the reason that I went here to comment.
I reported the problem in 2015, to solve that I put a
target="_self"
on every state link to force a page to reload and do not generate detached dom leaks, but would be great to activate normal transition again.PS: I didn't migrate to 1.0 because I didn't find any way to load controller files with the route in a lazy way.
7f2aed1
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.
@LeonanCarvalho 545 is closed because nobody has been able to post an example of a memory leak caused by ui-router.
I ran your example plunker and I don't see any obvious memory leaks, nor dom node leaks.
Did you read my comment discussing how to post an example reproduction? angular-ui/ui-router#545 (comment)