siddii / angular-timer

re-usable/inter-operable AngularJS timer directive ⛺
http://siddii.github.io/angular-timer/
MIT License
791 stars 939 forks source link

Garbage collection on Single Timer Example #223

Open sime opened 8 years ago

sime commented 8 years ago

Hello,

I'm diving into plugging memory leaks in my application. I've quickly discovered that the most basic example of angular-timer does a lot of garbage collection.

Any tips on what to look out?

http://siddii.github.io/angular-timer/examples/angularjs-single-timer.html

screen shot 2015-11-11 at 16 49 47
siddii commented 8 years ago

Only thing is.. probably using $timeout rather than setTimeout. Also, can you try in other browsers & if this is the case?

siddii commented 8 years ago

Also.. Thanks for profiling this :+1:

sime commented 8 years ago

Okay so I have looked in Firefox, Safari and Internet Explorer and I am unable to provide a similar report as I did in Chrome.

Firefox shows some drop in frame rate, but I cannot see anything that explicitly says Garbage Collection. Safari I cannot find a tool to report on memory. Internet Explorer doesn't show any dramatic changes in memory usage.

I tried the same profile in Chrome Canary and the got the same result in Chrome.

siddii commented 8 years ago

I am guessing its a Chrome thing... perhaps using setTimeout does this all the time in Chrome (not sure though)

sime commented 8 years ago

I managed to filter the Firefox reporting.

screen shot 2015-11-11 at 17 31 41
siddii commented 8 years ago

doesn't look too bad on Firefox. So its a Chrome thing?