If you have an app that absolutely needs a lot of memory (transcoding HD videos in my case), before running it;
- Spawn a new process and catch the unix signals for that process, specifically SIGINT.
- Have that new process allocate all the memory you need in your actual process.
- The OS will kill via it's Low Memory Killer (LMK) daemon.
- Since you caught the SIGINT in the parent process you can avoid the Android "Application X is using too much memory" notification that pops up to the user making it a silent failure.
- Lastly sleep a few MS to let Androids LMK kill other apps.
Now run your intensive memory process. This works for games too. A huge hack but needed for some of the lower end devices that don't have GB of RAM. Also needed since Java apps will just eat memory until something tells them to clean up, you need some overallocation to fail to trigger the whole memory free process on Android.