Sample app to test stressapptest on android for creating memory pressure on device.
adb push stressapptest /data/local/tmp/
adb shell chmod 777 /data/local/tmp/stressapptest
adb shell /data/local/tmp/stressapptest -s 20 -M 990 -C 8
-s for total time you want to run memory stress, -M for megabytes of ram to test, -C for total threads to be used for stressing memory, defaults to number of CPUs. Details of other options are here in documentation.