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

[Transition][memory leak] Dispose unused transition #55

Closed
aitboudad opened this issue May 31, 2017 · 2 comments
Closed

[Transition][memory leak] Dispose unused transition #55

aitboudad opened this issue May 31, 2017 · 2 comments

Comments

@aitboudad
Copy link
Contributor

aitboudad commented May 31, 2017

part of ui-router/angular#21

I did some debugging and I noticed that the issue is resolved if I reset _treeChanges when starting a new transition in Transition::startTransition

var oldTransition = globals.transitionHistory.dequeue();
if (oldTransition) {
  oldTransition.promise.then(
    () => oldTransition._treeChanges = {},
    () => oldTransition._treeChanges = {},
 );
}
@attrobit
Copy link

when will this bug be fixed?

@christopherthielen
Copy link
Member

reopened per uirouter/angularjs comment angular-ui/ui-router#3603

wawyed pushed a commit to wawyed/core that referenced this issue Mar 3, 2018
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 ui-router#55
Fixes angular-ui/ui-router#3603
Fixes ui-router/angular#21
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

No branches or pull requests

3 participants