[EVO 4G Android Development] Papa Smurf151:
[SCRIPT] Smurfed Out V 5.0 (ultimate build.prop/init.d tweaks) Updated 3-18

Explanation of LMK Settings (Low Memory Killer)

and

Explanation of Adj and Minfree settings

When your phone boots up, a file inside the boot image (init.rc) sets the system parameters. Things like the path to framework files, setting up your networks, and setting the limits at which programs are killed off to free RAM are done by this file. Now a super-Android-geek might dig inside the init.rc file and completely customize the low memory killer, but you don't have to do this to still get good results. The init.rc sets up six different "levels" of open applications. Let's have a look at them:

FOREGROUND_APP: This is the application currently on the screen, and running

VISIBLE_APP: This is an application that is open, and running in the background because it's still doing something

SECONDARY_SERVER: This is a process (a service that an application needs) that is alive and ready in case it's needed to do something

HIDDEN_APP: This again is a process, that sits idle (but still alive) in case it's needed by an app that's alive and running

For the most part, we never want to adjust when these apps and processes are killed off. They are the things that the programs we use need to properly function. For the more bold and advanced users, changing settings for HIDDEN_APP settings is possible, albeit with a LOT of trial and error. There's two more settings, and these are the ones most interesting to us today:

CONTENT_PROVIDER: This is apps that provide data (content) to the system. HTC Facebook Sync? That's a CONTENT_PROVIDER. So are things like the Android Market, or Fring. If they are alive, they can refresh and provide the content they are supposed to at the set interval. If you kill them, they can't of course.

EMPTY_APP: I call these "ghosts." They are apps that you have opened, but are done with them. Android uses a unique style of handling memory management. When an activity is ended, instead of killing it off Android keeps the application in memory so that opening them again is a faster process. Theses "ghost" apps use no battery or CPU time, they just fill RAM that would be otherwise empty. When this memory is needed by a different application or process, the RAM is flushed and made available for the new app. To satisfy the geekier people (like myself) Android does this by keeping a list of recently used apps, with the oldest apps in the list given the lowest priority -- they are killed first if RAM is needed elsewhere. This is a perfect way to handle 'ghost' processes, so there's no need to touch this part ;)

So when you see settings like this 8,14,40,50,60, 75 you start with the first setting and it looks like this

FOREGROUND_APP = 8

VISIBLE_APP = 14

SECONDARY_SERVER = 40

HIDDEN_APP = 50

CONTENT_PROVIDER = 60

EMPTY_APP = 75

You can manipulate these numbers so that they are better managed and give You different aggressiveness and a faster UI

For the Smurfed Out script the settings are as follows

Lite = 8,14,55,70,85,100

Medium = 8,14,75,90,95,125

Max = 25,35,55,70,150,250

Extreme = 25,35,75,90,150,250

Minfrees are set as well but they are equal to the LowMemoryKiller ADJ settings.

I personally run them at Max while using ICS but everyone's experiences will be different.