What Is The Normal Memory-ram Size?(xamarin)
Solution 1:
First question what kind of memory is this with red circle? Is it Ram? Or heap memory?
Working Set : refers to the total physical memory (RAM) used by the process. For more detail information you could refer to : What is private bytes, virtual bytes, working set?
Second question what is the normal size for each apk. Is it safe bigger than a number of memory?
Android provide MemoryClass on ActiviyManager API to get the value for your device, for deatail information, you could refer to : What is the maximum amount of RAM an app can use?
Third question my application if this memory is above 380mb. In some cases it crashes my apk.
As you said, your application has ListView
with images and in some cases it crashes your apk, when you app load many image at one time it will occupy lots of memory, and it usual cause OutOfMemoryError
, so I think your problem is an OutOfMemoryError. You should pay more attention to the heap size in your app instead of the Working Set
. As the Android document said :
To allow multiple running processes, Android sets a hard limit on the heap size alloted for each app. The exact heap size limit varies between devices based on how much RAM the device has available overall. If your app has reached the heap capacity and tries to allocate more memory, the system throws an OutOfMemoryError.
Since we don't know how did you load images to your listview, here are some suggestion :
It is recommend to implement image cache, but there is no need to reinvent the wheel, focus on the core logic of your app instead. Just use a known and solid framework for Cache & Fetching images, like Picasso or Glide. Then you can use it to load image in your
listview
like this:Picasso.With(context).Load(imageUrl).Into(imageView);
- Try to implement View Holder Pattern to increases the performance
ListViews
. Xamrin.Android example here.
- Try to implement View Holder Pattern to increases the performance
- Make sure there is no memory leak in your Application.
Post a Comment for "What Is The Normal Memory-ram Size?(xamarin)"