• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

S6 Ram Management Discussion(Partial Fix)

Has your multitasking been improved


  • Total voters
    301
Search This thread

Xileforce

Senior Member
Feb 27, 2012
3,057
3,125
Since we've been talking about this pretty extensively in a different thread I figured I would make a new thread for discussing, troubleshooting and attempting to improve the ram management issue on the S6.

Hopefully some good will come of this :)

So far this Is what we've got:

Should work on all variants including the edge and possible on other Samsung devices.

Thanks to @mikeyinid for finding these and @s.rapp for answering questions, and making the instructions easier to understand :)
And anyone else who I may have missed who helped contribute.

Prerequisites:
-A rooted device
-A root file explorer/manager app
-A backup of your original build.prop to be safe

Explanation: (From @mikeyinid )
Here is a quick rundown on how this came about, and what we actually know.

Since I purchased the S6 on release day, I've been messing with certain things, as you can see from the ROM I posted, Looper(shameless plug). Debloating Samsung apps really helped with battery life and I was pretty happy with the results. But like so many other people, I didn't understand why my S6 killed apps so aggressively. Initially I thought it might be the memory leak we all know so much about in 5.0. So, I did a little research and found the patch for that. While it did help keep the device stable over time, apps were still being killed with no prejudice. All this time I noticed really useless services running in the background, often stuff I'd never even opened. I studied LMK and started messing with those settings. After a month of trying everything I could find documented, I was ready to give up. Yesterday I was looking through the services.jar smali for the 37,875th time and realized the DHA referenced in there has to have something to do with memory management. I kept overlooking it because I hadn't seen mention of it anywhere else. I am no smali guru, as some of you know. But it was pretty obvious DHA was influencing memory management to some extent. Samsung, although leaving us in the dark on this, was kind enough to give us props to set the values for DHA. I pulled a few that seemed relevant, added them to my build.prop, and what do you know. For the first time in almost two months of tinkering, I saw an improvement in the way my device was managing memory.

The thing everyone needs to understand; I have no clue what DHA is. It overrides every aspect of Googles LMK and seems to do so in a way that makes more sense. I'm sure someone with more knowledge than myself will be able to tune this to the point the S6 will be the multi-tasking champ. There are several other props in the smali that are probably useful. I will try to get them all with their default values posted today. This has been pretty exciting for me, I spent way to much time trying to figure out the issue to not make some sort of progress. I hope you guys enjoy the tweaks, and I hope it helps sway those of you on the fence about keeping this device to stay. It's only gonna get better

Instructions:
First find your build.prop. This is located in /system. to get to /system you need to go to the root directory using a file explorer and then go to the system folder. The build.prop will be in there. You can also use and app such as build.prop tweaker but its a bit harder (imo)

In your build.prop scroll to the very bottom and paste this in:
Code:
# MultiTasking Tweaks
ro.config.dha_cached_max=15
ro.config.dha_cached_min=4
ro.config.dha_empty_max=36
ro.config.dha_empty_min=9
ro.config.dha_empty_init=36
ro.config.dha_lmk_scale=0.545
ro.config.dha_update_max_count=5
ro.config.dha_step=2
ro.config.dha_th_rate=1.4
ro.config.dha_defend_th_level=0
ro.config.64bit_lmk_enable=true
ro.config.sdha_apps_bg_max=70
ro.config.sdha_apps_bg_min=8
ro.config.dha_ils_enable=true
ro.config.dha_ils_dyna_lmk=true
ro.config.dha_ils_rate=1.5

Now you need to find and remove any duplicate build.prop lines which may cause an issue. So look through the build.prop and remove any lines that look like these(Not the ones you just added at the bottom!):

ro.config.dha_cached_max=
ro.config.dha_empty_max=
ro.config.dha_th_rate=
ro.config.dha_lmk_scale=

Finally reboot your device and report back here!

Video Tutorial (courtesy of @Thin_Bezel )

https://youtu.be/d-vaLXF0OxY

A note from @mrapp :
"The major addendum here seems to be that when using this build.prop apps like Chrome and and those calling webpages via Webview (Tinfoil for Facebook) still suck. The kernels being tested at the moment don't appear to have this issue, so if you're capable of flashing kernels I personally recommend checking out the Vindicator thread if you're on T-Mobile/W8 or UniKernel (universal) if you're on any other device. UniKernel tests may or may not be edge friendly, so always make a backup. Lots of people have gotten in to trouble today. Don't be one of them!"

Please note we are constantly experimenting with different values so these are subject to be updated rather frequently :)
 
Last edited:

iFlasher

Senior Member
Feb 13, 2013
613
194
Piñas
As I was saying before, Maybe someone can try compare Zenfone 2 services.jar with the one in samsung galaxy s6.

The Asus Zenfone 2 is knowed to had a great multitasking experience, it can keep a loot of apps even in his 2GB version, and remember that Zenfone is in Android 5.0 and don't have any problem with multitasking.

I already downloaded the firmware for Zenfone and decompiled his services.jar if someone like to try something, here is attached:
 

Attachments

  • services.zip
    2 MB · Views: 699
Last edited:

mikeyinid

Senior Member
Sep 4, 2010
8,875
4,000
Boise
As I was saying before, Maybe someone can try compare Zenfone 2 services.jar with the one in samsung galaxy s6.

The Asus Zenfone 2 is knowed to had a great multitasking experience, it can keep a loot of apps even in his 2GB version, and remember that Zenfone is in Android 5.0 and don't have any problem with multitasking.

I already downloaded the firmware for Zenfone and decompiled his services.jar if someone like to try something, here is attached:

I'll take a look at it, but I've already gone through several different services.jar trying to find anything that might make a difference. Everything appears to be exactly how Google intended it to be.
 

Xileforce

Senior Member
Feb 27, 2012
3,057
3,125
I'll take a look at it, but I've already gone through several different services.jar trying to find anything that might make a difference. Everything appears to be exactly how Google intended it to be.

I also noticed that Samsung uses the ramdisk to set VM memory settings and lmk settings rather than actually modifying the source for some reason. I tried removing all of these and letting the settings be stock google but that also made no difference :(

Sent from my SM-G920T using XDA Free mobile app
 

mikeyinid

Senior Member
Sep 4, 2010
8,875
4,000
Boise
I also noticed that Samsung uses the ramdisk to set VM memory settings and lmk settings rather than actually modifying the source for some reason. I tried removing all of these and letting the settings be stock google but that also made no difference :(

Sent from my SM-G920T using XDA Free mobile app

Right, all of that can be controlled with init.d scripts. i set the values ridiculously high and can see that that scripts actually work. Then going the other way no matter how low I set them or even disable them, there is no difference. Still can't have more than 5 or so apps open.
 

Xileforce

Senior Member
Feb 27, 2012
3,057
3,125
Right, all of that can be controlled with init.d scripts. i set the values ridiculously high and can see that that scripts actually work. Then going the other way no matter how low I set them or even disable them, there is no difference. Still can't have more than 5 or so apps open.

What's a good test to see if memory management is improved? I've done some mods to lmk in my latest kernel and want to see if it helps any.

Sent from my SM-G920T using XDA Free mobile app
 
  • Like
Reactions: Fruktsallad

mikeyinid

Senior Member
Sep 4, 2010
8,875
4,000
Boise
Yea figured...the issue apparently isn't the lmk then...

Sent from my SM-G920T using XDA Free mobile app

I don't know a whole about kernel stuff. Does there happen to be any oom_adj stuff in there?

I'm losing hope that this will be fixed with any update. I think moving to arm64 may have shot Samsung in the foot. What is the other arm64 lollipop device samsung has released? Note 4?.

---------- Post added at 07:00 PM ---------- Previous post was at 06:57 PM ----------

Yea figured...the issue apparently isn't the lmk then...

Sent from my SM-G920T using XDA Free mobile app

It's not. It has nothing to do with lmk. I've messed with every possible scenario, pulled in stuff from cm and see no difference. Even changing oom_adj values in services.jar makes zero difference.
 

Xileforce

Senior Member
Feb 27, 2012
3,057
3,125
I don't know a whole about kernel stuff. Does there happen to be any oom_adj stuff in there?

I'm losing hope that this will be fixed with any update. I think moving to arm64 may have shot Samsung in the foot. What is the other arm64 lollipop device samsung has released? Note 4?.

---------- Post added at 07:00 PM ---------- Previous post was at 06:57 PM ----------



It's not. It has nothing to do with lmk. I've messed with every possible scenario, pulled in stuff from cm and see no difference. Even changing oom_adj values in services.jar makes zero difference.

I meant I thought it may help with killing recents so soon. It had some tweaks to preserve favorites among other things

Sent from my SM-G920T using XDA Free mobile app
 

CQ7

Senior Member
Mar 18, 2007
335
53
I don't know a whole about kernel stuff. Does there happen to be any oom_adj stuff in there?

I'm losing hope that this will be fixed with any update. I think moving to arm64 may have shot Samsung in the foot. What is the other arm64 lollipop device samsung has released? Note 4?.

---------- Post added at 07:00 PM ---------- Previous post was at 06:57 PM ----------



It's not. It has nothing to do with lmk. I've messed with every possible scenario, pulled in stuff from cm and see no difference. Even changing oom_adj values in services.jar makes zero difference.
I have note 4 too and it has same problem with latest lollipop update, i switched to cm12.1 and now all the problem are gone, switching between apps it's really fast and apps stay in ram flawlessly.
 

Xileforce

Senior Member
Feb 27, 2012
3,057
3,125
I have note 4 too and it has same problem with latest lollipop update, i switched to cm12.1 and now all the problem are gone, switching between apps it's really fast and apps stay in ram flawlessly.

Interesting. This gives me hope! Ty for sharing. Im pretty sure its an issue on the ROM side rather than kernel.

Sent from my SM-G920T using XDA Free mobile app
 

Fruktsallad

Senior Member
May 15, 2011
714
218
Interesting. This gives me hope! Ty for sharing. Im pretty sure its an issue on the ROM side rather than kernel.

Sent from my SM-G920T using XDA Free mobile app
Right, but what on the ROM side could be causing this kind of behavior? I see myself as quite tech savvy, but I'm woefully uninitiated in the inner workings of Android you guys are unraveling here.

Even after removing just about all of Samsungs proprietary stuff, just leaving the bare basics, we're still seeing app genocide as soon as we're multitasking.

It'd sure be awesome of the community fixes this before Samsung does...
 
  • Like
Reactions: DjSkreem

oxxshadow

Senior Member
Apr 2, 2012
1,230
156
Has Samsung acknowledge this issue and said they will fix it with the 5.1.1 update? Honestly, I feel like for the premium you pay for this phone, this is very ridiculous. Things like these can really make or break a purchase. I myself have not got the S6 solely for this reason, I cannot justify spending 600+ on a device which cannot even keep up with my 3 year old Nexus 4.

I hope they do fix it this month though. What are the chances they will though, the S6 is selling well so Samsung probably does not care about these things.
 

mikeyinid

Senior Member
Sep 4, 2010
8,875
4,000
Boise
Has Samsung acknowledge this issue and said they will fix it with the 5.1.1 update? Honestly, I feel like for the premium you pay for this phone, this is very ridiculous. Things like these can really make or break a purchase. I myself have not got the S6 solely for this reason, I cannot justify spending 600+ on a device which cannot even keep up with my 3 year old Nexus 4.

I hope they do fix it this month though. What are the chances they will though, the S6 is selling well so Samsung probably does not care about these things.

The S6 isn't selling as well as Samsung had hoped. And the memory issue is probably a large part of it. I have a S4 also, and it doesn't have any issues multi tasking on lollipop. It's shameful that a 3 year old device can managed to run just about everything I throw at it with no problem.
 
  • Like
Reactions: mr. greenhorn

Xileforce

Senior Member
Feb 27, 2012
3,057
3,125
Has Samsung acknowledge this issue and said they will fix it with the 5.1.1 update? Honestly, I feel like for the premium you pay for this phone, this is very ridiculous. Things like these can really make or break a purchase. I myself have not got the S6 solely for this reason, I cannot justify spending 600+ on a device which cannot even keep up with my 3 year old Nexus 4.

I hope they do fix it this month though. What are the chances they will though, the S6 is selling well so Samsung probably does not care about these things.

Samsung has acknowledged the ram issue and said they will fix it in an update. That's about as specific as they got. My guess would be 5.1.1 update though.

Sent from my SM-G920T using XDA Free mobile app
 

Fruktsallad

Senior Member
May 15, 2011
714
218
Samsung has acknowledged the ram issue and said they will fix it in an update. That's about as specific as they got. My guess would be 5.1.1 update though.

Sent from my SM-G920T using XDA Free mobile app

Sadly, Samsung has neither acknowledged the specific issue nor promised any updates. All the articles in the blogosphere regarding this (including the one from Forbes) cite a Facebook comment from a random Samsung employee giving an incredibly vague and generic response about future updates when asked a direct question about the memory issue by xda member johanbiff.

I'm baffled by the low level of journalism here.

EDIT: Typo.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 51
    This is EPIC!!! Can you please post all necessary build.prop tweaks in one post to make it easier?

    Also, if you could please post which build.prop tweaks need to be added manually, and which are already there but the values just need to be changed?

    Thanks SO MUCH for this.
    I discovered nothing, if you're looking for someone to thank, give all thanks to @mikeyinid :D

    All I did was write this post (original post)

    In your build.prop under #DHA Properties change these two lines:

    Code:
    ro.config.dha_cached_max=12
    ro.config.dha_empty_max=36

    Add these 4 lines:
    Code:
    ro.config.dha_th_rate=2.3
    ro.config.dha_lmk_scale=0.545
    ro.config.sdha_apps_bg_max=70
    ro.config.sdha_apps_bg_min=8

    Scroll down beyond the DHA properties where the other properties are stored and remove duplicate entires of

    Code:
    ro.config.dha_cached_max=
    ro.config.dha_empty_max=
    ro.config.dha_th_rate=
    ro.config.dha_lmk_scale=

    Finally this one will change your LMK values:

    Code:
    ro.config.oomminfree_high=7628,9768,11909,14515,16655,20469

    The major addendum here seems to be that when using this build.prop apps like Chrome and and those calling webpages via Webview (Tinfoil for Facebook) still suck. The kernels being tested at the moment don't appear to have this issue, so if you're capable of flashing kernels I personally recommend checking out the Vindicator thread if you're on T-Mobile/W8 or UniKernel (universal) if you're on any other device. UniKernel tests may or may not be edge friendly, so always make a backup. Lots of people have gotten in to trouble today. Don't be one of them!
    40
    Since we've been talking about this pretty extensively in a different thread I figured I would make a new thread for discussing, troubleshooting and attempting to improve the ram management issue on the S6.

    Hopefully some good will come of this :)

    So far this Is what we've got:

    Should work on all variants including the edge and possible on other Samsung devices.

    Thanks to @mikeyinid for finding these and @s.rapp for answering questions, and making the instructions easier to understand :)
    And anyone else who I may have missed who helped contribute.

    Prerequisites:
    -A rooted device
    -A root file explorer/manager app
    -A backup of your original build.prop to be safe

    Explanation: (From @mikeyinid )
    Here is a quick rundown on how this came about, and what we actually know.

    Since I purchased the S6 on release day, I've been messing with certain things, as you can see from the ROM I posted, Looper(shameless plug). Debloating Samsung apps really helped with battery life and I was pretty happy with the results. But like so many other people, I didn't understand why my S6 killed apps so aggressively. Initially I thought it might be the memory leak we all know so much about in 5.0. So, I did a little research and found the patch for that. While it did help keep the device stable over time, apps were still being killed with no prejudice. All this time I noticed really useless services running in the background, often stuff I'd never even opened. I studied LMK and started messing with those settings. After a month of trying everything I could find documented, I was ready to give up. Yesterday I was looking through the services.jar smali for the 37,875th time and realized the DHA referenced in there has to have something to do with memory management. I kept overlooking it because I hadn't seen mention of it anywhere else. I am no smali guru, as some of you know. But it was pretty obvious DHA was influencing memory management to some extent. Samsung, although leaving us in the dark on this, was kind enough to give us props to set the values for DHA. I pulled a few that seemed relevant, added them to my build.prop, and what do you know. For the first time in almost two months of tinkering, I saw an improvement in the way my device was managing memory.

    The thing everyone needs to understand; I have no clue what DHA is. It overrides every aspect of Googles LMK and seems to do so in a way that makes more sense. I'm sure someone with more knowledge than myself will be able to tune this to the point the S6 will be the multi-tasking champ. There are several other props in the smali that are probably useful. I will try to get them all with their default values posted today. This has been pretty exciting for me, I spent way to much time trying to figure out the issue to not make some sort of progress. I hope you guys enjoy the tweaks, and I hope it helps sway those of you on the fence about keeping this device to stay. It's only gonna get better

    Instructions:
    First find your build.prop. This is located in /system. to get to /system you need to go to the root directory using a file explorer and then go to the system folder. The build.prop will be in there. You can also use and app such as build.prop tweaker but its a bit harder (imo)

    In your build.prop scroll to the very bottom and paste this in:
    Code:
    # MultiTasking Tweaks
    ro.config.dha_cached_max=15
    ro.config.dha_cached_min=4
    ro.config.dha_empty_max=36
    ro.config.dha_empty_min=9
    ro.config.dha_empty_init=36
    ro.config.dha_lmk_scale=0.545
    ro.config.dha_update_max_count=5
    ro.config.dha_step=2
    ro.config.dha_th_rate=1.4
    ro.config.dha_defend_th_level=0
    ro.config.64bit_lmk_enable=true
    ro.config.sdha_apps_bg_max=70
    ro.config.sdha_apps_bg_min=8
    ro.config.dha_ils_enable=true
    ro.config.dha_ils_dyna_lmk=true
    ro.config.dha_ils_rate=1.5

    Now you need to find and remove any duplicate build.prop lines which may cause an issue. So look through the build.prop and remove any lines that look like these(Not the ones you just added at the bottom!):

    ro.config.dha_cached_max=
    ro.config.dha_empty_max=
    ro.config.dha_th_rate=
    ro.config.dha_lmk_scale=

    Finally reboot your device and report back here!

    Video Tutorial (courtesy of @Thin_Bezel )

    https://youtu.be/d-vaLXF0OxY

    A note from @mrapp :
    "The major addendum here seems to be that when using this build.prop apps like Chrome and and those calling webpages via Webview (Tinfoil for Facebook) still suck. The kernels being tested at the moment don't appear to have this issue, so if you're capable of flashing kernels I personally recommend checking out the Vindicator thread if you're on T-Mobile/W8 or UniKernel (universal) if you're on any other device. UniKernel tests may or may not be edge friendly, so always make a backup. Lots of people have gotten in to trouble today. Don't be one of them!"

    Please note we are constantly experimenting with different values so these are subject to be updated rather frequently :)
    11
    You know me, always willing to test some stuff! If you come up with anything concrete that you want to test, let me know :D

    I'm uploading a video to youtube, I'll let you guys decide if it's any better :p

    ---------- Post added at 01:39 PM ---------- Previous post was at 01:35 PM ----------

    I just enabled 64bitlmk and I don't think it did anything. No idea why its not enabled by default tho

    Sent from my SM-G920T using XDA Free mobile app

    It's probably either broken, or you have to disable DHA. I still haven't 100% found the line to disable DHA.

    ---------- Post added at 01:48 PM ---------- Previous post was at 01:39 PM ----------

    Here is the video. This is less than a minute after a reboot. Notice XDA doesn't reload, sqlite doesn't after the first time, and messages stays in the same thread. I'm not sure exactly how many apps I was cycling through but more than I've ever been able to before. Have a look. @mrapp, I think it's a huge improvement over what I was seeing
    New S6 Multitasking: https://youtu.be/RuOHy-k7onk
    10
    Here is my init.d script and DHA settings. Don't ask me how to do it, I'm going to sleep. Just wanna have a few others try these settings. Your rom needs init.d support obviously.

    #!/system/bin/sh

    sleep 10

    echo "80" > /sys/module/zswap/parameters/max_pool_percent
    echo "130" > /proc/sys/vm/swappiness
    echo "50" > /proc/sys/vm/vfs_cache_pressure
    swapoff /dev/block/vnswap0
    echo "2558973740" > /sys/block/vnswap0/disksize
    mkswap /dev/block/vnswap0 &> /dev/null
    swapon /dev/block/vnswap0 &> /dev/null

    Here are my DHA settings

    ro.config.dha_cached_max=12
    ro.config.dha_cached_min=3
    ro.config.dha_empty_max=30
    ro.config.dha_empty_min=4
    ro.config.dha_empty_init=30
    ro.config.dha_lmk_scale=0.272
    ro.config.dha_th_rate=1.4
    ro.config.dha_defend_th_level=1
    ro.config.sdha_margin_min_low=10
    ro.config.sdha_margin_min_high=50
    ro.config.sdha_apps_bg_max=50
    ro.config.sdha_apps_bg_min=6


    Basically what I'm doing is doubling swap, bumping max pool to keep more in ram(that's what it's suppose to do anyway) and setting very relaxed DHA/LMK settings.
    8
    You guys may be in store for a pleasant surprise ?