# Memory Leaks

**URL:** <https://forum.ionicframework.com/t/memory-leaks/10036>\
**Category:** ionic-v1\
**Created:** [September 22, 2014, 7:33pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036 "2014-09-22T19:33:18Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![camtera](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@camtera](https://forum.ionicframework.com/u/camtera)\
**Post date:** [September 22, 2014, 7:33pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/1 "2014-09-22T19:33:19Z")

</div>

Thanks for a fantastic project, we feel ionic is by far the **best hybrid platform** available. We have used the platform in our apps; however, cordova / ionic / angular stability issues challenges our ability to quickly deploy and scale apps. To be clear, it is more important for us to have a stable platform, than more features (e.g., Ionic Creator).

One serious issue we’ve encountered are DOM node and memory leaks. We have verified this using ionic beta10, beta11 and the latest nightly build (ionic-bower#1.0.0-beta.12-nightly-482) running the xcode activity monitor instrument. Unfortunately we can’t pinpoint the exact cause, and unsure if Cordova, Angular, or Ionic is the culprit; however, it does seem to be worse when running on an iPhone compared to Google Chrome (Mac).

All of our Ionic ios apps leak nodes and memory, and the other ionic ios apps in the Apple store leak memory as well. To demonstrate, I downloaded a Drifty app that uses beta10. By switching back and forth between tabs for 7 minutes, the app crashes, as it exceeds 600 MB of RAM threshold set by ios.

Here is the video showing how the drifty’s app “HN Front Page” memory grows until the crash (video shown at 2x speed):

I know these issues have been reviewed before, but it looks like not completely fixed.

> <https://github.com/ionic-team/ionic/issues/1096>

Any help uncovering this issue would be appreciated. Thanks, Steve

* * *

HN Front Page App:

> **[HN Front Page on the App Store](https://itunes.apple.com/us/app/hn-front-page/id905998731)**
>
> Read reviews, compare customer ratings, see screenshots, and learn more about HN Front Page. Download HN Front Page and enjoy it on your Apple TV.

* * *

---

<div class="post-metadata">

**Author:** ![flenkey](https://avatars.discourse-cdn.com/v4/letter/f/ce73a5/32.png) [@flenkey](https://forum.ionicframework.com/u/flenkey)\
**Post date:** [September 27, 2014, 3:29am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/2 "2014-09-27T03:29:12Z")

</div>

I submitted app to Apple Store based on ionicFramework beta 12. They rejected the app because of memory leaks. Could this be related? I need help ASAP, as I don’t know how to respond to Apple. I don’t know how to check or fix the memory leaks. _Can someone please help this issue?_

---

<div class="post-metadata">

**Author:** ![Cris](https://avatars.discourse-cdn.com/v4/letter/c/71e660/32.png) [@Cris](https://forum.ionicframework.com/u/Cris)\
**Post date:** [September 27, 2014, 10:34pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/3 "2014-09-27T22:34:56Z")

</div>

OMG 600 mb in ram? O.o this is so weird… On windows machine, ( and then Adnroid ofcourse ) I haven’t this memory leaks … sorry but in iOS i’m completely noob ☹

Hope you guys recieve help form some of ionic team,

Good luck and sorry again.

---

<div class="post-metadata">

**Author:** ![szuzul](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@szuzul](https://forum.ionicframework.com/u/szuzul)\
**Post date:** [September 28, 2014, 8:11am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/4 "2014-09-28T08:11:49Z")

</div>

Did you try to reopen the issue?

---

<div class="post-metadata">

**Author:** ![darrenahunter](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@darrenahunter](https://forum.ionicframework.com/u/darrenahunter)\
**Post date:** [September 28, 2014, 10:08am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/5 "2014-09-28T10:08:23Z")

</div>

+1 to reopen and fix asap - am going to push apps to app store shortly

---

<div class="post-metadata">

**Author:** ![coen\_warmer](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/coen_warmer/32/64036_2.png) [@coen\_warmer](https://forum.ionicframework.com/u/coen_warmer)\
**Post date:** [September 28, 2014, 10:31am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/6 "2014-09-28T10:31:54Z")

</div>

@darrenahunter:

`1.` It is not certain the issue @camtera is reporting is in fact due to all apps built with Ionic, or a specific implementation that they are using. I have never had memory issues to speak of with my Ionic apps, and I have already succesfully submitted 5 apps to the iTunes store. That doesn’t mean they don’t exist, it just means further research is required.

So are you experiencing memory issues yourself with your app?

`2.` If so, why don’t you go to the GitHub and actually add to the discussion on that issue? Just saying here ‘open the issue’ won’t make it so.

---

<div class="post-metadata">

**Author:** ![camtera](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@camtera](https://forum.ionicframework.com/u/camtera)\
**Post date:** [September 28, 2014, 3:56pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/7 "2014-09-28T15:56:35Z")

</div>

@darrenahunter  
Thanks for the feedback. I downloaded your Southern Cosmetics app (nicely done!) to understand how your implementation is not leaking.

But unfortunately I see your app leaking as well – it crashed after 7 minutes of continuous tapping in your tab navigation, consuming more than 500MB (very similar to the video above). I’m using an iPhone 5s running iOS7.1.2.

Here is the screenshot of your app memory usage before it crashed:  
 ![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/4239/96ed9f9abf937b00.png)

I will do more research and reopen the memory issue.

[https://itunes.apple.com/us/app/southern-cosmetics/id890712690?ls=1&mt=](https://itunes.apple.com/us/app/southern-cosmetics/id890712690?ls=1&mt=)

---

<div class="post-metadata">

**Author:** ![darrenahunter](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@darrenahunter](https://forum.ionicframework.com/u/darrenahunter)\
**Post date:** [September 28, 2014, 10:20pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/8 "2014-09-28T22:20:42Z")

</div>

thanks @coen_warmer for your in site - very helpful

there is plenty of mounting evidence we have an issue here - yes it may not be ionic but it is still an important issue if we can’t push our ionic apps to the app store due to memory usage.

so many talented people in this community especially the ionic guru’s that re raising this issue is important - so we get many eyes on it

and congrats on push 5 apps to the app store. doesn’t mean they don’t have memory leaks as @camtera pointed out with one of my apps accepted into the app store.

looking forward to your input on this too

---

<div class="post-metadata">

**Author:** ![darrenahunter](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@darrenahunter](https://forum.ionicframework.com/u/darrenahunter)\
**Post date:** [September 28, 2014, 10:31pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/9 "2014-09-28T22:31:53Z")

</div>

Hi @camtera

The Southern Cosmetics app is actually one I did. Thanks for taking the time to have a look at it.  
Does the leak only come from switching tabs or also navigating via the sidemenu.

I will try and spend sometime today on this. I recall I viewed a very good Addy Osmani video on memory management and using chrome devtools to dig deeper. see link [http://addyosmani.com/blog/video-javascript-memory-management-masterclass/](http://addyosmani.com/blog/video-javascript-memory-management-masterclass/)

cheers  
Darren

---

<div class="post-metadata">

**Author:** ![camtera](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@camtera](https://forum.ionicframework.com/u/camtera)\
**Post date:** [September 28, 2014, 11:58pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/10 "2014-09-28T23:58:48Z")

</div>

Darren, I edited my post, thanks. I only tested your app switching betweens tabs.

When troubleshooting and researching this, the issue seem more significant in iOS than Chrome. This might be related to UIWebView problems, or Chrome’s approach to garbage collection.

---

<div class="post-metadata">

**Author:** ![darrenahunter](https://avatars.discourse-cdn.com/v4/letter/d/ecb155/32.png) [@darrenahunter](https://forum.ionicframework.com/u/darrenahunter)\
**Post date:** [September 29, 2014, 12:03am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/11 "2014-09-29T00:03:51Z")

</div>

wonder how it goes with the new WKWebView in iOS8 - I don’t have it installed as yet or an iPhone 6

---

<div class="post-metadata">

**Author:** ![tslater](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/tslater/32/66538_2.png) [@tslater](https://forum.ionicframework.com/u/tslater)\
**Post date:** [June 3, 2015, 9:49pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/12 "2015-06-03T21:49:06Z")

</div>

I’m having the exact same issue with tabs on iOS. If the content of the tab is large, the problem is really bad.

As a side note, I also very much agree that ionic’s success will be determined by the work they put into the framework rather than all the extra services. The framework is awesome, but is not robust. It doesn’t help developers with large amounts of data very well. Ex. collection-repeat is a great concept but javascript scrolling is slow and buggy on most android phones that it really forces a developer to choose between a long render wait or a very sluggish scroll.

---

<div class="post-metadata">

**Author:** ![bractar](https://avatars.discourse-cdn.com/v4/letter/b/ed8c4c/32.png) [@bractar](https://forum.ionicframework.com/u/bractar)\
**Post date:** [June 8, 2015, 9:33pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/13 "2015-06-08T21:33:44Z")

</div>

I’m having this issue as well.  
When calling a route, I remove my objects, clear $timeout and $interval, call $ionicHistory.clearCache().  
But the issue is still here and my app becomes unstable after a moment.  
I don’t know what else I can clear at this point. I really believe it’s an Ionic issue and not an AngularJs issue.

---

<div class="post-metadata">

**Author:** ![pink\_tshirt](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@pink\_tshirt](https://forum.ionicframework.com/u/pink_tshirt)\
**Post date:** [June 9, 2015, 2:15am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/14 "2015-06-09T02:15:10Z")

</div>

Silly question - what do u use to take those measurments in the video?

---

<div class="post-metadata">

**Author:** ![camtera](https://avatars.discourse-cdn.com/v4/letter/c/278dde/32.png) [@camtera](https://forum.ionicframework.com/u/camtera)\
**Post date:** [June 9, 2015, 2:50am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/15 "2015-06-09T02:50:28Z")

</div>

Memory Monitor, part of Xcode Instruments

more info:  
[https://developer.apple.com/library/ios/documentation/AnalysisTools/Reference/Instruments\_User\_Reference/MemoryMonitorInstrument/MemoryMonitorInstrument.html](https://developer.apple.com/library/ios/documentation/AnalysisTools/Reference/Instruments_User_Reference/MemoryMonitorInstrument/MemoryMonitorInstrument.html)

---

<div class="post-metadata">

**Author:** ![kylethielk](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/kylethielk/32/90635_2.png) [@kylethielk](https://forum.ionicframework.com/u/kylethielk)\
**Post date:** [July 17, 2015, 5:52pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/16 "2015-07-17T17:52:33Z")

</div>

I was having these huge memory leaks as well in iOS 8 only. Switching over to WKWebView instantly eliminated these for me: [https://github.com/Telerik-Verified-Plugins/WKWebView](https://github.com/Telerik-Verified-Plugins/WKWebView)

Pay special attention to the limitations of WKWebView which might not make it ideal for every app.

---

<div class="post-metadata">

**Author:** ![Felifetp](https://avatars.discourse-cdn.com/v4/letter/f/90db22/32.png) [@Felifetp](https://forum.ionicframework.com/u/Felifetp)\
**Post date:** [July 21, 2015, 1:38am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/17 "2015-07-21T01:38:11Z")

</div>

anyone from the ionic staff can comment over this subject??

i know no normal user will change as many page’s as he did in the first minute of the video…  
(although if i had native-inline or banner ads on each page i would no complain xP; 1k users = 100k+ view’s)

anyway…  
i guess the user will need reset the app always, i mean he can’t use as a background app with push notification, he will need close and open for use each day… and if depend’s on the loaded page size it sounds like can get much worse, with large images and videos…

this still a issue?? they know where is the bottleneck(angular, ionic, other js libraries or others sources)??

---

<div class="post-metadata">

**Author:** ![lazamar](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/lazamar/32/91137_2.png) [@lazamar](https://forum.ionicframework.com/u/lazamar)\
**Post date:** [November 27, 2015, 12:36pm UTC](https://forum.ionicframework.com/t/memory-leaks/10036/18 "2015-11-27T12:36:42Z")

</div>

This is being discussed in ticket #1096 on Github [https://github.com/driftyco/ionic/issues/1096#ref-issue-40172100](https://github.com/driftyco/ionic/issues/1096#ref-issue-40172100)

---

<div class="post-metadata">

**Author:** ![vahidvdn](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/vahidvdn/32/94016_2.png) [@vahidvdn](https://forum.ionicframework.com/u/vahidvdn)\
**Post date:** [February 12, 2017, 10:18am UTC](https://forum.ionicframework.com/t/memory-leaks/10036/19 "2017-02-12T10:18:27Z")

</div>

Is there any fix? I have this problem too.
