I once read about an init.d tweak to keep an app in memory. I'm unable to find that tweak now. Does anyone have the link? An alternate method would also be welcome.

Edit : I'm using cyanogenmod 10.

  • Cyanogen has an option to keep the current launcher pinned to memory (check the CM-menues if that is what you're looking for) -- but I don't know about any option to do that for any other app.
    – Izzy
    Aug 24, 2012 at 13:55

1 Answer 1


You can do it according to this post on XDA:

  1. Make a file called 99applock.txt
  2. Insert code below and put you messaging service in where it says PPID (that usually can be found in data/data if your using aftermakrket sms app) remove the .txt extension and put file in ect/init.d and just give it 777 permissions, it works for me.

    sleep 60

    PPID=$(pidof com.your.app)
    echo "-17" > /proc/$PPID/oom_adj
    renice -18 $PPID
  • Does that only work if the app is started within that 60s sleep period -- or is this init script run repeatedly? I don't see a loop or anything indicating that this would also work for an app started at a later time.
    – Izzy
    Sep 4, 2012 at 20:00
  • There must be a catch with this? Surely, keeping it in memory will starve other apps of precious RAM and could cause Android to go berserk when trying to manage apps that hit the memory threshold and quite potentially p-off users who are wondering why the app is not loading when that threshold gets reached!
    – t0mm13b
    Jan 31, 2013 at 17:03
  • 2
    This seems to work well... at first. but if i watch the oom_adj file i find that pretty soon it is no longer -17, and then my app can be killed again
    – Michael
    Sep 19, 2013 at 22:09
  • 1
    Upvoted comment of @Michael as this method still does not work (updated to N 7.1). Also tried making oom RO (444), but after the set delay (few minutes), it reverts to previous value. Nothing across the Internet I've found will accomplish the task.
    – u2n
    Jul 24, 2019 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .