[Galaxy Note 4 Android Development (Snapdragon)] Senthil360:
RAM Management

So without further delay let me start with the LMK (Low Memory Killer) parameters

1.Foreground Applications - These are the the current applications that you are using in front of your eyes , For example the browser while you are browsing

2. Visible applications - Let's say after downloading something using browser , it loads another page in the meantime you open the file with a file manager, Now here the Browser is Visible Application and File manager is Foreground application

3. Secondary Server - The components of UI and launcher fall in this category

4. Hidden Applications - This one is little anamolous , the apps which are not running currently visibly like the browser or file manager i mentioned above , but these are the apps that run in background and live on RAM (some are essential, some are useless (bloat) )

5. Content Provider - We can call these linked apps , for example when pressing a number in whatsapp , the dialer comes up here the dialer app is content provider for whatsapp

6. Empty Applications These are needless apps just running and living on RAM which can be killed

Ok Now let's see what happens with the values we set..

To put it simply , suppose say we set the values as 88 , 110 , 132 , 164 , 176 , 220 respectively for the slots 1 to 6 .. (Note 4 5.1.1. Default values ) ,

Lets take the 132 , 3rd slot for example , I said the 3rd slot i.e 'Secondary Server' holds things such as UI launcher related stuff ,

That's Ok but what the hell does 132 represents ? It is nothing but a parameter which tells the system to always keep the 3rd slot a minimum free available memory of 132 MB , so when you try to add more launchers or UI stuff see lags because the system is killing/struggling to keep 132 mb free but you are not allowing it to settle by overloading stuff , you may ask then why can't we simply reduce that value so that it can survive ,

That's right way to think but the problem are

1. To keep android stable the lmk values should be in order i.e 1<2<3<4 <5<6

2. When you reduce these values RAM is piled up with loads of apps which will have negative impact on battery and performance ..

So which way to go , what's the ideal solution , before we discuss that let mention a few more things ...

* The RAM management is completely different in Touchwiz (poor) and Aosp/cm (good) - Samsung has tons of bloat apps , services processes which are like a parasite on the RAM

*Note When i said System keeps a minimum of 132 mb for secondary server it doesn't mean 132 mb out of whole RAM

** Total Availble RAM is NOT the same as Total physical RAM

** There are things such as overcommitt ratio , memory , low watermark to consider which is too much tedious to discuss here right now

** Lastly locking app in memory or assgning oom (out of memory) score to apps are not possible since kitkat due to changes in Android Run Time (ART)

With these points in mind lets proceed to find out the working method to improve our Note 4's RAM management

If you have read all the points , I guess by now you might have an idea of what does what..

Generally,

The first three control multitasking

The last three, can be increased to free up RAM

** NAMELESS Users need NOT use any values , I have intergrated special formula and mechanism inside ROM for scheduler and RAM management

LMK values

Default 5.1.1 - 88 , 110 , 132 , 164 , 176 , 220

Multitasking - 48, 56 , 64 , 110 , 132 , 166

Balanced - 56 , 64 ,82 , 194 , 250 , 305

Gaming/ Aggressive - 32 , 64 , 128 , 250 , 470 , 512

Thank you , thats it for now