Ionic app using too much ram memory


#1

Hi,

Im not sure if is normal, but my app use 56 mb of ram, each time I close and re-open it and navigate thru the app the memory increase 5-8 mb of ram getting very high usage (100+mb) this is normal ?


#2

I’d say you might be doing something wrong. I have an app with 8 different routes or “states”, long lists, pull in a phone’s entire addressbook (500+ contacts). I can switch back and forth between all the screens, scroll, close, re-open, add info, etc and never get over 50MB ( < 35MB without accessing contacts).

If you have long lists, you should probably checkout bindonce : https://github.com/Pasvaz/bindonce


#3

Thank you @Calendee
I will try bindonce for next version. My app offent > 60MB, in screen i use “highcharts” > 80MB :frowning:


#4

I use 3 states, with 3 different list

<div ng-repeat="new in news" class="list card">
    <div ng-click="loadnews('{{new.url}}')" class="item">
        <h2 ng-bind-html="new.title"></h2>
            <p>{{new.daten}}</p>
      </div>
       <div class="item item-body">
           <img class="newsimg" src="{{new.image}}">
            <p ng-bind-html="new.content"></p>
   </div>
</div>

,

<list can-swipe="false" option-buttons="button">
      <item ng-click="playsong(file)" hold="showOptions(file)" ng-repeat="file in unrelease" item="file">
<i class="icon {{file.pstatus}}"></i>
{{file.name}}</item>
</list>

you think Bindonce will help ?


#5

Again, if you have realy long lists, bindonce will help with performance. It removes all the watches from bound data. If you have massive lists, it will not help reduce amount of memory.

You might also want to start using ng-src instead of src for your images. It will make the page look a bit nicer while the images are loading.


#6

@Calendee

I have problem about memory too, start to open app is 60MB then click, change view, scroll up >80MB :frowning:
my app request to API and return json data.

This is my implement for a route, Ex: /category

/*-------------Implement Category Factory--------------*/

myApp.factory(‘categoryService’, function ($http) {
$http.defaults.useXDomain = true;

var factory = {};

factory.postServiceHelper = function (params) {
    return $http({
        url: appUri.BaseUri,
        method: "POST",
        data: $.param(params),
        headers: { 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }
    });
};

//get top categories
factory.getTopCategories = function (callback) {
    var parameter = {
        DataServer: appUri.DataServer,            
        RequestAction: "SearchCategory",            
        Published: true,
        Deleted: false
    };

    factory.postServiceHelper(parameter).success(function (data) {
        if (data != undefined && data.Data != undefined && data.Data.length >0) {                
            callback(data.Data);               

        } else {
            callback(null);
        }
    });
};    

return factory;

});

In controller:

myApp.controller('CategoryController', function ($scope, categoryService) {

init();

function init() {
    $scope.loadingReady = false;
    
	//get top categories
    categoryService.getTopCategories(function (data) {
        $scope.topCategories = data;
        $scope.loadingReady = false;
    });             
}    

});

Have problem with my code? thank you.


#7

please help, thank you so much


#8

BTW, candy crush Saga takes 205-210 Mb (OpenGL ES 2) . I don’t think its an issue.