Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Change views frequently lead to too much memory consumed #10638

Closed
karimfikry opened this issue Jan 4, 2015 · 6 comments
Closed

Change views frequently lead to too much memory consumed #10638

karimfikry opened this issue Jan 4, 2015 · 6 comments

Comments

@karimfikry
Copy link

Using ng-view and switch its content frequently consume too much memory in Chrome, Firefox, Safari as I noticed it goes larger and never clear the memory of the previous used view.

For example: when I launch the application for the first time let's say It consume ~100 MB of RAM, then I change the view 10 times, then It almost reach ~800 MB. So It appends the memory and don't destroy the old view's content.

I checked #3543 and It seems to be fixed by 1.3.0-beta.20, but after testing my application it seems that it's not resolved yet.

@karimfikry karimfikry changed the title Memory Change views frequently lead to too much memory consumed Jan 4, 2015
@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 4, 2015

would it be possible for you to create a plunker that shows this?

@karimfikry
Copy link
Author

@lgalfaso

I created a small plunker which of course don't match the original case (As I have private data in it), but at least will show you the problem I'm pointing to. To regenerate the issue, please click on the bottom button (switch view) frequently and track the memory in Task Manager, you will find it increasing rapidly

Also, kindly find my question on stackoverflow regarding this issue

@Narretz
Copy link
Contributor

Narretz commented Jan 6, 2015

I have downloaded the plnkr and opened the test page as the only tab in FF and Chrome, and then switched views every other second, and checked the memory consumption in Windows Task Manager.

  • with FF, I notice a slight increase in memory (maybe 10 MB for every 10 switches), but that is reduced to almost baseline after a certain amount of time (even when continuing to switch)
  • Chrome does not cause any rise in memory consumption.

Can you reproduce the problem with this plnkr? Otherwise it might be content / a directive inside the view that is not cleaned up properly.

@Narretz Narretz added this to the Purgatory milestone Jan 6, 2015
@lgalfaso
Copy link
Contributor

lgalfaso commented Jan 6, 2015

I did the same test and was not able to see any increase in memory usage.

@karimfikry
Copy link
Author

So, the question is how to clean directives properly? As I really have a directive used in ng-repeat and frequently I remove the first element in the array (which isn't not existing in DOM, but still reserve memory).

The directive I'm using is wavesurfer-angular.

I'll update my plunker sooner and re-post it

@Narretz
Copy link
Contributor

Narretz commented Jan 16, 2015

I'm gonna close this, but feel free to reopen this issue when you have updated the plnkr.

@Narretz Narretz closed this as completed Jan 16, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants