Tuesday, June 3, 2014

Balancing Battery Life and Memory on the Galaxy Player 5 on Beanstalk 4.4+

Venturi is a low ram legacy device. Let's face it, it's old. Don't get me wrong, I love the device but going forward it's going to be more and more difficult to get good performance and the Android OS grows; Difficult but not impossible. One of the most challenging performance bottlenecks is RAM. We only have 512Mb, In the next release for the YP-G70, I've increased the available system RAM to 451Mb by stealing some ram back from OMX. OMX is responsible for encoding and decoding audio and video. As a result we are losing "Hardware" support for rendering HD video. Actually, Venturi could only render 720p video anyway and we can still render HD video using "Software" decoders. Personally I use MX Player and you only need to select the "SW" decoder and video renders great. I personally think it's an excellent trade off.

Another way to insure a good balance between battery life and available memory is to manage your "minimum free memory" options in "Settings -> Performance -> Memory Settings".

There are 4 presets:
  1. Very Light
  2. Light
  3. Medium
  4. Aggressive
  5. Very Aggressive

"Very Aggressive" tries to keep the most free memory. When it detects that the amount of free memory is less than what you specified then the "Low Memory Killer"(LMK) goes through the list of processes that are running and kills any of them that it can until the specified amount memory is free. You might think that is going to be the best option but not necessarily so; That option may cause LMK to be constantly working to free memory even when you are not doing anything. I suspect that when some apps are killed, they get automatically re-launched. So LMK is eating your battery by constantly killing apps.

You can observe this behaviour running the following commands in the terminal emulator or adb:
cat /proc/kmsg
You will see message like the following:
select 14561 (android.vending), adj 15, size 11020, to kill
send sigkill to 14561 (android.vending), adj 15, size 11020
Every time you see those messages, it's LMK trying to free memory to satisfy the request of  keeping "minimum free memory". It's OK to see it occasionally but if  it's happening all the time, the "minimum free memory" setting is too high and you try lowering it.

I usually float between Aggressive and Normal.

No comments:

Post a Comment