-
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
Transition with all the data remains in heap - memory leak? #3603
Comments
Similar issue: ui-router/angular#21 |
Please try your experiment again, but this time click the "collect garbage" button before stopping the profiler (it is the small trash can icon next to the "Memory" checkbox in your screenshot). My tests show that memory use is not increasing significantly. Applications (and therefore, ui-router) do not have any control over triggering garbage collection. It's done completely at the javascript runtime's discretion. See this comment for more details on reporting memory leak bugs: #545 (comment) |
Thanks for your reply. I looked more in Detail by doing a memory heap dump. When i do a heap dump via memory -> take heap snapshot, chrome do a garbage collection before. I did a heap snapshot on hello state, about state and again hello state. The number of memory increase constantly. And i recognized that for every state change a new "Transition"-Object retains in the heap. See the following screenshots. |
for clarity, did you force a garbage collection between each heap dump? Edit: I tried it myself and see that Transitions are indeed being retained. Thanks for the analysis |
This is an issue in uirouter/core. Follow this related issue: ui-router/core#55 |
The leak still exist. Testet with Version 1.0.14 (example) JS-Heap over time (Switched multiple times between hello and about state): The number of Transition-Objects still increases. See the foolowing heap-dump. |
reopened ui-router/core#55 |
…les*.data Fixes #55 Fixes angular-ui/ui-router#3603 Fixes ui-router/angular#21
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
This is a (check one box):
My version of UI-Router is: (type version)
1.0.12, but the problem also exists in version 1.0.5
Bug Report
Current Behavior:
When switching between states, the JS-Heap increase and get not garbage collected. See the following screenshot.
For the example above i used the uirouter example in plunker.
As i analyzed the heap in detail i saw that the number of Transition-Objects increase with time.
Expected Behavior:
The JS-Heap get garbage collected after switching back to previous state.
Link to Plunker or stackblitz that reproduces the issue:
You can reproduce the problem with the uirouter example app in plunker: example
Just switch multiple times between the state "hello" and "about".
The text was updated successfully, but these errors were encountered: