Phone is an Alcatel Pixi 4 4034 (which has 512MB RAM). For various reasons, I've ended up with an unofficial Cyanogenmod 13 port on it. The problem I have is that the phone periodically slows down and crashes, apparently hanging for a couple of seconds then rebooting.
Doing a bit of digging in the logs, I've found that it's running out of memory immediately prior to the crashes. I get lots of messages about the ActivityManager terminating various processes, but it clearly isn't enough because when I managed to connect adb during the reboot, I managed to get the following smoking gun from
adb shell dmesg:
[ 4784.206692] (3)[181:logd.klogd]Out of memory: Kill process 28595 (ndroid.systemui) score 0 or sacrifice child [ 4784.206715] (3)[181:logd.klogd]Killed process 28595 (ndroid.systemui) total-vm:761596kB, anon-rss:8552kB, file-rss:0kB
This seems to be the root cause of the reboot: systemui is an essential service, and terminating it is going to cause the reboot, and indeed moments later I see:
[ 4784.439624] (0)[1:init]init: Starting service 'bootanim'...
Any suggestions how I can prevent this from occurring? Why is the low memory killer not able to prevent the failure before it happens?