Vaibhav Shah
Vaibhav Shah

Reputation: 528

Memory Issue in angular Js Application

I am facing memory leak issue in angular js application. I have tried all the possible solutions like profile tool, timeline and some other tools related to angular js. My Work till now -

Profile Tool

In profile tool JS heap is keep on getting increased but can't able to find the reason for it. Detached dom element keep on increasing

Timeline

It shows there is a possibility of memory leaks but still I don't know how to debug and fix it.

enter image description here

Task Manager

It keep on increasing the memory size.Some time it is getting garbage collected but not significantly. enter image description here

Please let me know how to debug and find out what could be the issue.Or share your experience if you have faced the same issue.

Upvotes: 9

Views: 974

Answers (1)

user2513697
user2513697

Reputation:

AngularJS has memory leaks when there are many bindings. Now limitation of angularJS is that it has 2-way binding. So, if you change any value in model, view that triggers $diget(), $watch() loop. So, depending upon how big your application is it consumes memory.

I suggest to try couple of steps:

  • Calculate angular Scope objects using angular batarang
  • Scopes $destroy() Method to free memory
  • Try to reduce your JS consumed in page. Use whatever is required

In my application I reduced watchers and life was easy.

Upvotes: 1

Related Questions