How to Simulate Low Memory in the Android Emulator

How do you simulate low memory in the Android emulator?

Invoke ulimit command from the shell.

ulimit -Sv 10000

This will set current memory limit to 10 000 Kb, so that all apps invoked from this shell afterwards won't be able to access more memory.

Simulate low RAM on android phone

The android emulator can run really smooth if you have an Intel CPU on your machine. In order to use to create a smooth emulator, you'll need the following:

1 Install Intel HAXM on your computer. Available here
http://software.intel.com/en-us/articles/installation-instructions-for-intel-hardware-accelerated-execution-manager-microsoft

2 Create a new AVD in AVD Manager, and for CPU select Intel Atom (x86)

cpu selection

3 Make sure you check Use Host GPU option

4 Start the emulator. If everything is ok, you should see a message like this
Sample Image

How to simulate Android killing app caused by low memory in AndroidStudio 4

I found the way:

Since AndroidStudio 4, if you run the app from AndroidStudio play button, logcat terminate button will simulate a complete stop of the app, instead of a low memory kill.

The solution is launching the app from the icon in the emulator, them that terminate button will simulate the low memory kill correctly.



Related Topics



Leave a reply



Submit