# Memory Leak?

**URL:** <https://forum.ionicframework.com/t/memory-leak/2823>\
**Category:** ionic-v1\
**Created:** [April 9, 2014, 6:33pm UTC](https://forum.ionicframework.com/t/memory-leak/2823 "2014-04-09T18:33:03Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![cnanders](https://avatars.discourse-cdn.com/v4/letter/c/e8c25b/32.png) [@cnanders](https://forum.ionicframework.com/u/cnanders)\
**Post date:** [April 11, 2014, 4:29am UTC](https://forum.ionicframework.com/t/memory-leak/2823/4 "2014-04-11T04:29:43Z")

</div>

I am also experiencing a memory leak/issue. I have a bare-bones ion-side-menus style app that is a book. Like this:

```
<ion-side-menus>
     <ion-side-menu-content>
         <ion-nav-view name="menuContent">
             <!-- section of the book loaded into content -->
         </ion-nav-view>
    </ion-side-menu-content>
    <ion-side-menu side="left">
        <-- ul of links -->
    </ion-side-menu>
</ion-side-menus>

```

As I click links in the side menu, the “menuContent” nav-view gets filled with different book pages. The problem is my book pages are “heavy” - each page has 10 Mb to 20 Mb of .m4v video elements along with text. If I quickly click through the side menu to load every page, I can get the memory on my iPhone5 all the way to 500 Mb at which point Xcode force closes the app.

I’ve tried purging the $viewHistory (see code below). This code does work to purge the viewHistory, but it doesn’t solve my memory problem. Here is the code I used to purge the view history each time I swap out a section with a controller:

```
$rootScope.$viewHistory = {
	histories: { 
		root: { 
			historyId: 'root', 
			parentHistoryId: null, 
			stack: [], 
			cursor: -1 
		} 
	},
	backView: null,
	forwardView: null,
	currentView: null,
	disabledRegistrableTagNames: [],
	views: {}
};

```

---

_[View the full topic](https://forum.ionicframework.com/t/memory-leak/2823)._
