Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android counterpart of iOS memory warning

In iOS an app will receive a memory warning by implementing a function called DidReceiveMemoryWarning, which means the RAM is not enough to use. If a Level 2 version of this warning is sent, the app will probably be force stopped.

Is there something similar (like a broadcast intent) in Android to tell my app that we're out of RAM and i could remove some objects programmatically?

Thanks.

like image 632
Garfield the Dummy Avatar asked Feb 08 '13 07:02

Garfield the Dummy


People also ask

What is PSS memory in Android?

When inspecting your app's heap, Android computes a value called the Proportional Set Size (PSS), which accounts for both dirty and clean pages that are shared with other processes—but only in an amount that's proportional to how many apps share that RAM.

What is heap size Android?

The Heap is used for dynamic memory allocation. To provide a smooth user experience, Android sets a hard limit on the heap size for each running application. The heap size limit varies among devices and is based on how much RAM a device has.

What is the onTrimMemory () method?

onTrimMemory. Called when the operating system has determined that it is a good time for a process to trim unneeded memory from its process. This will happen for example when it goes in the background and there is not enough memory to keep as many background processes running as desired.

What is memory warning on Iphone?

Overview. iOS sends your app a warning when its memory use approaches the limit of available device memory. The amount of memory use that triggers a memory warning corresponds to the yellow region in Xcode's memory gauge.


1 Answers

You should define your own custom application object by extending Android Application class and define that object in the Application tag in the manifest file. In this custom object you can override the onLowMemory() method.

Hope this helps you.

like image 81
Gopinath Avatar answered Oct 16 '22 08:10

Gopinath