1

I have an Angular application that loads in only the needed controller / factory or service when it needs to. However i started wondering if all of these scripts eats up the memory the longer my client uses my application.

Take for instance the following example:

Client1 logs into my application here the following controllers are loaded:

LoginController
UserController

Together with these some factories and services are loaded in to store the user for furture reference.

As my Client1 goes through my system the application keeps on adding scripts but never dumping the ones it does not use.

At the last page of my application all of my controllers,factories and services has been loaded and stored in the memory however only a few is actually being used and only a few will be used again.

Should i be concerned about this once my application grows or is that just the normal procedure of AngularJs?

1
  • depends what app does. I have a feed reader app I leave open for days at a time. It makes requests every 10 minutes and will add/remove several hundred entries a day. It gives me far less headaches (or memory leaks) than a simple wordpress page with constant running slide show on it does Commented Oct 7, 2015 at 23:26

1 Answer 1

1

It sounds to me like this will be the least of your concerns if your application grows. When it comes to overhead and optimization, there's a lot of issues that will be significantly more memory consuming than loaded javascript files.

For instance, too many bindings in your view, listeners you haven't removed on a $scope $destroy event, caching of API calls. I think you shouldn't really worry about this, your application would have to be way too big for this to be an issue, and when this happens, you'll be able to simply optimize the many other areas that are more worrying.

Here you have a few tips to optimize your angular app before you even take this into account.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.