yashsingh1/xdaforums huggingface dataset:
[G 2014 Android Development] DiamondBond:
NASA called and they want there scientist back...

xD

Kidding around bro, once again gr8 analysis , this sort of proves lp has a memory leak and lmk issue or whatever, which is making lp unstable sadly (cm12 & stock) :/ but kk seems pretty smooth to me even with xposed! :)

Sent from my XT1068
[G 2014 Android Development] DiamondBond:
Thing is we never had 4.3 for our device right? Maybe we can back port or port it from moto g 2013, like back in my xperia play days someone managed to port honeycomb xD (useless but was fun)

Silly but might be a solution!

Also thanks, I will update the script today I think :)

And I'll see what i can do to fix up lollipop's stuttery frame rates and its bad lmk (if there is a fix lol)

Sent from my XT1068
[G 2014 Android Development] StariX37:
After running the script...phone does not seem to be smooth as earlier but the killing of apps has stopped. Now i can multitask with around 4 apps properly. Only issue is that it has become a bit laggy.

Currently i m using the Super Multitasking profile.

Btw Thnx for u script :thumbup: Its a great script.

Hope u give some fixes to the lag issue.
[G 2014 Android Development] DiamondBond:
Yeah this is the downside to being able to multitask xD id prefer it though over having apps freaking reloading every second, temp fix is to use the Boost option from within the script ;)
[G 2014 Android Development] meadillas11:
At first was skeptical about the bug on the lowmemorykiller module issue, I didn't notice any kill on other devices with Kitkat.

But after making some logcats to all my devices i found results that follow your hypothesis:

All logcats started just before a soft reboot and were 2 min long.

Model Version RAM Killings

Huawei u8160 CM 2.3.7 128 MB 0
HTC Desire Z CM 4.2.2 368 MB 0
Moto G 2014 Stock 4.4.4 851 MB 56
BQ Aquaris 5.7 Stock 4.4.4 1965 MB 75

So yeah, from what I see it is not just a Moto issue... I guess...
[G 2014 Android Development] devsk:
Can you please update the bug on the issue tracker with this info? Just attach this data there. Its very useful piece of info.

https://code.google.com/p/android/issues/detail?id=98332

While there, make sure to star it...;) There are way more issues on the tracker which are not that important but have way more stars than this bug. We need to mobilize folks to bring this issue to the forefront of the tracker....:)
[G 2014 Android Development] StariX37:
I switched to Multitasking Profile (not the super multitasking) and used the boost option.Now my phone runs smoothly.. :)
[G 2014 Android Development] DiamondBond:
Thanks! its what it was made for ;)

Sent from my XT1068
[G 2014 Android Development] rufflove:
[MENTION=1416236]devsk[/MENTION] As I understand it, memory management in Android has been dynamic since 4.4 (?); the Activity Manager monitors usage patterns and adjusts accordingly. LMK settings etc are used as a baseline, but are not absolute. So there is no perfect fix without building from source or decompiling and modifying the framework. I am currently considering selling my Moto G because of this.
[G 2014 Android Development] RestlessScreams:
Maybe there's some way to run your script with Tasker during boot. But since it's .pdf I didn't find a way to do it. Maybe you could create it as .js :b
[G 2014 Android Development] meadillas11:
http://xdaforums.com/moto-g-2014/development/script-ram-fix-t3007889/post58322640

There :D
[G 2014 Android Development] RestlessScreams:
Ouh, thanks :D
[G 2014 Android Development] feligoni:
Maybe making a script for each profile will let people make the script run directly on boot easier, since there wouldnt be any need of user interaction by having a script for each profile. I mean if i want multitasking i download only that script and make it run on every boot so it modifies the values directly. Just a thought :P
[G 2014 Android Development] TheCreat:
For those saying it's KitKat that is causing this issue, I can confirm that it's deffinitely not the case. I'm coming from a Galaxy S2 and bought the MotoG when that was stolen (which also means I can't do direct/live comparisons). I was running Cyanogen/AOKP/Omnirom on that, which was also Android 4.4.4, and the device has the same 1 GB of RAM. I never had any issues on that thing, and nothing even remotely as bad as on the MotoG.

Even with the extreme multitasking profile, when I return to the home screen the Launcher is sometimes reloaded. While it's much better than stock, it's still a far cry from the rather ancient S2. And even when that doesn't happen, basically every time when returning to the home screen the "simple calendar widget" has to be reloaded. Another thing that basically never happened on the S2 (I can't remember a single instance, and I'm pretty sure I'd have noticed...).

If the base rom was the issue, this issue should be just completely gone when using Cyanogenmod. I personally haven't tried, as I'm on stock (21.11.23.titan_retde.retdeall.en.DE) + root. I have tried (and am using) custom kernels, mainly for experimenting with governors and the like, but that's about it.

Nothing I have tried has improved the situation even close to how it was on the S2, but this script is still the best so far (thanks for that). Combined with the horrible touch-screen issue I have (and many others, as I understand it), I'll probably sell this damn thing. Should've probably bought the old MotoG, which doesn't have these issues either from what I've read. Another point that contradicts the theory that it's Android 4.4's fault, btw...
[G 2014 Android Development] StariX37:
There's an issue with the LMK drivers.

I m using CM 12 ...and multitasking is even worse..on it. U cant even minimise opera mini app on it.

But by using the Multitasking profile...from this script has solved the issue for me...now i can multitask easily..& smoothly.
[G 2014 Android Development] DiamondBond:
Will add an installer option :) JavaScript file? Hmm I think the post init .sh is much easier xD

Yes I will do something like this soon, procrastination gets the better of me...

Agreed, it is just really bad on our device but a 26/1/15 cm mainstream update fixed lmk issues or something it, said on there gerrit, so might give it a try when a new build is out :)

Yes I know, cm12 is even worse than kk in multitasking, have to try with cmpime or cm12 but without unamed kernel :)

Also a new update to cm mainstream code was added on the 26 and it did some lmk changes. Might help us :D

Sent from my XT1068
[G 2014 Android Development] sryverfx:
I didn't change anything for us, only for devices with 512MB or less memory :/

I've tested new CM12 build and multitask is still impossible.

But the multitask is very good in official lollipop and on Titan Prime rom (official stock based)
[G 2014 Android Development] feligoni:
Yep, thats because Motorola released an OTA update a few time ago, I think when 5.0.2 was released via OTA, that included new kernel so it works better, not 100% fixed but better memory management. Since CM12 has its own kernel tree, until there's a fix from Google or CM we will suffer from this problem.
[G 2014 Android Development] DiamondBond:
Well im going to test it and see specificly, it says "low memory devices" so maybe 800mb is low memory, lol, idk, :) thanks for info though ;)

Thanks for info,i think CM will jump on the issue faster than Google, :)
[G 2014 Android Development] DiamondBond:
working on rt-rm, expect update in a couple of hours ;)
[G 2014 Android Development] DiamondBond:
updated.

changes:

- fixed typo

- added permanent lmk options

- added on boot = boost (drop pagecaches, dentries & inodes)

size: 11.8kb (double the size now... what... she... said...)

enjoy! :)
[G 2014 Android Development] devsk:
Soooo....Android L has a new thing called LMKD, the low memory killer daemon...:) As if the in-kernel low memory killer module was not enough, we needed another user space daemon (or demon in this case because its literally killing everything left and right) to make life harder...:D This is the reason for more aggressive killing in L compared to KK.

For this reason also, the minfree is somewhat useless in Lollipop. LMKD is doing the killing by itself after getting feedback from the Android activity manager process. LMKD is also adjusting the adj_score of processes to align with what activity manager tells it the tasks are doing. So, making a process less prone to kill by adjusting its score (like my script did for the firewall) is not possible because LMKD is going to change it right back.

In nutshell, we are screwed until someone really fixes https://code.google.com/p/android/issues/detail?id=98332
[G 2014 Android Development] metalrules321:
[MENTION=1416236]devsk[/MENTION]

So what I get is that, we have a bit less insane killings on kitkat then we have it on LP ??

If thats true , I shudder to think what the state of app killings on lollipop is at currently >,>
[G 2014 Android Development] devsk:
KK potentially has other issues, whose side effect is seen as choppy audio and foreground app killing on Moto G. My benchmark for Moto G is that if maps can navigate me for more than 1 hour with my songs running over bluetooth without any sound being choppy or music stopping, then, I have found the Moto G nirvana. I have been able to do that once with L running my script above, which drops caches every 5 seconds. Not tried it again yet (not fond of wasting 1 hour driving uselessly even if its for bigger cause...:D).

L changed a bunch of things and that potentially mitigated some of the issues in KK. But one thing we know for sure is that killings are very excessive in L compared to KK. They don't need to be that excessive for the system to work effectively. If we can tone that down a bit, we will not only have better multi-tasking but also better battery life. That would be Moto G nirvana...:D
[G 2014 Android Development] metalrules321:
Oh you cheeky, B , you :cyclops:

lol :cyclops:
[G 2014 Android Development] DiamondBond:
lol thought someone would notice :D

Sent from my XT1068
[G 2014 Android Development] DiamondBond:
damn you DA real lmk mvp , this explains everything discovered so far! :)

Sent from my XT1068
[G 2014 Android Development] devsk:
I noticed that too but metal replied before me...and I didn't want to do a "me too" post...:D Very good use of "what she said"...:D
[G 2014 Android Development] devsk:
Do you guys get an email when I update the google issue?

I added Samsung S1 to the mix. Here is a phone with 380MB of available RAM running CM11 (with kernel 3.0) which can multitask better than Moto G without killing 100s of processes. Does anybody else get the feeling that something is very badly broken!...:)
[G 2014 Android Development] luca020400:
The newer version doesnt work on cm12

This because the permanent put the echo's in the post boot script and this file doesn't exist in custom ROMs

You should put them in a init.d script and then chmod 755 it

And ofc add an if that find if your ROM is stock or not ( a simple getprop $build.prop string | grep $something only in stock )

Hope you understand
[G 2014 Android Development] metalrules321:
[MENTION=1416236]devsk[/MENTION]

Yeah mate, we do get the mail when the issue is updated

Sadly, I feel the same way. I had a galaxy S plus before the moto , having 512MB of ram. And it pretty much ran, and still runs CM 11 without the app massacre.

It recently got the LP update too (albiet unofficial) but it still runs like a beast.

Im honestly dumbfounded, as to what exactly is going on with the moto's RAM issue ?? O_o

Read somewhere , that it *could* be a hardware issue, CPU side.

I pray that Im wrong ...
[G 2014 Android Development] DiamondBond:
Haha :D

Wow guess this device is broken and yes I suspect its a hardware issue.

Oh :( will add init.d options as well

I don't think its a CPU issue but I suspect its hardware based... ram or bad flash storage.

I hope were horribly wrong as well...

Sent from my XT1068
[G 2014 Android Development] DiamondBond:
tip: enable GPU rendering, it reduces load on CPU which seems to make ram be more snappy (methinks the cpu is a bottleneck) and make multitasking better and I get less ui frame rate drops (due to GPU rendering...) and etc... :) [MENTION=1416236]devsk[/MENTION] - check this out plis. ;)

Sent from my XT1068
[G 2014 Android Development] Fiasco:
Will this script run automatically at every boot or do I have to run it manually?
[G 2014 Android Development] DiamondBond:
*cough*cough**gives free pair of swag glasses for those who can't read op**cough*cough*

short answer: yes

long answer: yes if you select the permanent option

if you read the op answer: yes

:D BTW I'm kidding around so chill ;)

Sent from my XT1068
[G 2014 Android Development] metalrules321:
*buys multiple swag glasses, gives them to other op non- readers* xD

On a side note,

will be checking out the gpu rendering option. Could work wonders :D
[G 2014 Android Development] Fiasco:
I was just asking because SManager has a boot option right next to the root option. Wasn't sure if I had to enable that also.

My bad.

Finally my device runs more like I expected it to with 1GB Ram. Thanks for this script.
[G 2014 Android Development] metalrules321:
The GPU rendering option indeed seems to make a difference

hmmmm........could this point to a possible cpu issue.

I dont think the cpu being a bottle neck could be the reason, since the galaxy s plus being single core at 1.2 ghz and with 512

MB ram runs kk and cm11 fine without the app killing going into ted bundy mode
[G 2014 Android Development] DiamondBond:
XD

Yes sorry :) but the script has an on boot installation mode which works for everything except cm12 (working on that now)

Yes it does!

Might be the architecture and etc... CPU cores and speeds don't matter all the time. But I think it has something to do with this huge issue we are plagued with since it fixes things up a bit :)

Sent from my XT1068
[G 2014 Android Development] devsk:
Sorry, I took a break from all this...:)

I don't think forcing use of GPU rendering is needed. It should already be offloading the graphics to the GPU. Using the software rendering through CPU, its almost impossible to generate such nice animations. I have watched the CPU usage during transitions etc. and its not the bottleneck. Heck, the CPU barely touches its max frequencies and that's awesome for battery life.

I personally feel, its a software issue. It may be a combination of many things e.g. a memory leak in the core services (hence killing apps does not help and you have to keep killing some more) or just plain too many background daemons to fit in 1GB of RAM (hence it has to keep killing to maintain a working set) or may be the ART framework is just too memory hungry (hence forcing older processes out of memory) or may be Motorola is "tuning" the behaviour in some fashion which makes this problem worse. We don't know yet. Will know better after the memory leak fix comes out in 5.0.3.

These days every app wants to have a background daemon running all the time (to collect data and send it back...:() which implements the backend service and frontend just provides the UI element. So, even if you kill the app UI, the backend daemon keeps running. So, its also possible that we are dealing with a much larger set of processes in KK and L. If you have 500 processes vs 300, guess where the killing is going to show up prominently...:D This needs investigation.

Lets give credit where the credit is due. The LMK is actually not as dumb as we might think. It kills background daemons which are not associated with any last X apps with a UI visible (unless an app is unusually big RAM consumer, then it gets killed first). Now, X is a function of how much RAM is there in the system. It can not be very large e.g. HTC M7 with 2GB running 4.3, X is 9 but these 9 apps never reload when you switch to them, guaranteed. Samsung S1 with 512MB (380 usable) with CM11 (which is 4.4), X is around 6 before it has to kill. For our phone, X is close to 4.

So, LMK will kill and its needed if you don't want your phone to reboot every hour or so. But the issue at hand is how it changed in KK and then in L and/or may be for Motorola specifically, to make it kill hundreds of times per hour when the system is generally idle or when there is plenty of RAM free and system is not under memory pressure. None of the other phones do that.
[G 2014 Android Development] G_0:
I held off installing this as my only real issue with the men management was chrome reloading pages. I installed Shawn's CM and at 1.1 the bug got bad.

I use poweramp for music while browsing. That is the extent of my normal usage. After 1.1 poweramp would be killed and restarted when doing anything on my phone. Decided to try this an IT WORKS! No other changes were made.

Thank you thank you thank you! It may not be the Os level fix people want but it 100% makes a difference.

Used the suggested multitasking option and rebooted. Brilliant!
[G 2014 Android Development] DiamondBond:
:D I actually modded my minfrees just to do the exact same but with google play music, hope you enjoy it! :)

Sent from my XT1068
[G 2014 Android Development] DiamondBond:
ok my break from scripting is done! :D i am working on v1.3 right now and will release shortly, changes: fixed cm12 issues with the script.
[G 2014 Android Development] DiamondBond:
v1.3 done.

changes:

* v1.3 ~ fixed cm12 installation errors.

download:

* op attachments

[MENTION=5778309]luca020400[/MENTION] - try this :)

enjoy!
[G 2014 Android Development] luca020400:
Lol I never tired your script

I just opened it xd
[G 2014 Android Development] DiamondBond:
haha its ok, well i made it install to init.d and set perms as well, so it should work on cm12 now, ;)
[G 2014 Android Development] luca020400:
You haven't fixed it in the proper way.

It should work but it isn't clean

Sometimes you used EOF and other time echo ( when you should use OEF ofc )

init.d perm should be 755
[G 2014 Android Development] DiamondBond:
I used EOF for init.d cause im making a new file, otherwise when echoing to a file it overwrites, its weird the way the bash echo and eof command works, thats why, cause for the init.qcom file i want to add to the bottom (not overwrite, since it already has stuff in it) and i also make it write to init.d with EOF since its writing for the first time to the temp file on sd then it gets copied to the system/etc/init.d dir, i will fix the permission error, but if you try the installation method on stock kk or lp & cm12 you will see they all work, and dosnt effect the end user, i also was going to do the grep check for the build id to see if its cm, but there are going to be other custom roms, so i want to keep it working with all roms, :)

and true it may be messy but i dont have a tonne of time on my hands ;)

anyways thanks for constructive feedback :) will hop onto fixing the permission issue instantly!
[G 2014 Android Development] DiamondBond:
github master branch for all those interested: https://github.com/Pizza-Dox/RTRM
[G 2014 Android Development] luca020400:
Another "hot-fix"

I haven't found

mount -o rw,remount /system

In the script

Add it and every perm script will work ( needed for cm12 ) ;)

---------- Post added at 09:46 PM ---------- Previous post was at 09:44 PM ----------

Anyway I'll provide a pull request with some changes tomorrow ;)
[G 2014 Android Development] DiamondBond:
Haha forgot to to put this at the top... Will hop into it this afternoon, thanks again Luca ;)

Sent from my XT1068
[G 2014 Android Development] DiamondBond:
updated, thanks again for the help! :)
[G 2014 Android Development] luca020400:
Check githuh
[G 2014 Android Development] G_0:
1.5 has an issue at least on Shawn's CM12. You will see the 1.5 by Pizzadox title then black screen within smanager and it closes.

Cheers!
[G 2014 Android Development] DiamondBond:
Wow thanks to Luca guys v1.6 is completely awesome and it should work fine now :) thanks a tonne buddy [MENTION=5778309]luca020400[/MENTION]

source: https://github.com/Pizza-Dox/RTRM/blob/master/rtrm.sh

update is in OP... ;_ (give thanks to luca, not me)
[G 2014 Android Development] andreiutzu000:
This is awesome man. Thanks for your work. I use it on Swahn quantum v2.0 and it's very cool. Have a nice weekend! :)
[G 2014 Android Development] solzhenitsyn:
I'm getting the error "only position independent variables are supported" when using "boost me up scotty". Any idea what this means?

Also using "BB" option gives: "error - unknown cmd"

on CM12, using v1.6 of your script, and SU is ticked.
[G 2014 Android Development] DiamondBond:
Will take a look into it, have you installed busybox? The default CM one is a bit weird... [MENTION=5778309]luca020400[/MENTION] might also be able to help :) he's pretty good with shell scripting!

Sent from my Moto G 2014
[G 2014 Android Development] luca020400:
https://github.com/Pizza-Dox/RTRM/pull/2 :p
[G 2014 Android Development] DiamondBond:
Damn to fast, when on PC will merge :) then reupload here, thanks a tonne Luca! You da real MVP ;)

Sent from my Moto G 2014
[G 2014 Android Development] Electric Flute:
What the difference between this script and RAM manager APP?
[G 2014 Android Development] DiamondBond:
RAM manager app is heavy and uses ram, my script requires just a shell. Plus the RAM manager app has bad lmk values, the ones were using here a tuned for 800 megs of ram (what we have on our Moto G) + the name is cool: RealTimeRAMManager

:)

Sent from my Moto G 2014
[G 2014 Android Development] solzhenitsyn:
Thanks pizza, will try reinstalling busybox and report back.
[G 2014 Android Development] DiamondBond:
No problem :)

Sent from my Moto G 2014
[G 2014 Android Development] hoholee12:
nice values thx:)
[G 2014 Android Development] DiamondBond:
Damn! Lennarox, haven't seen you around in ages, how's your scripts going? ;)

And no probs, feel free to use them :)

Sent from my XT1068
[G 2014 Android Development] solzhenitsyn:
Still the BB option doesn't work, but the busybox reinstall did the trick with the main options
[G 2014 Android Development] DiamondBond:
Can you provide a screenshot of the BB option, BTW Luca has made some changes but I need to find the time to merge them + go through and edit the script also, I might be able to today or tmrw so expect a v1.7 soon with bug fixes and maybe some improvements.

Sent from my XT1068
[G 2014 Android Development] ironman3636:
Hi man, thanks for the good work. I am in cm12 quantum lp and when I try to apply the super multitasking perm I have a mkdir error. What I am doing wrong? Tia.
[G 2014 Android Development] luca020400:
Check my other pull request

https://github.com/Pizza-Dox/RTRM/pull/2

https://github.com/Pizza-Dox/RTRM/pull/3
[G 2014 Android Development] DiamondBond:
I can't merge on mobile :) I can get back internet on my laptop tonight / tmrw morning so I can merge them, and thanks a lot BTW! :D

Sent from my XT1068
[G 2014 Android Development] hoholee12:
i have some pull request for you too!:D
[G 2014 Android Development] DiamondBond:
Sweet! :D will take a look at it all and merge and edit as necessary, thanks for the support! :)

Edit

Holly crap, this is amazeballs! :D thanks a tonne, will merge all these changes along with Lucas changes, and will publish with you 2 pimps as contributors :)

BTW love the kraby patty secret sauce thing lol only had a quick look so far so will get into it tonight :D

again thanks alot!

Sent from my XT1068
[G 2014 Android Development] solzhenitsyn:
Yeah will do. Unfortunately my external SD card seems to have failed while I was in the middle of a TWRP restore operation so the phone is a bit buggered atm...

Sounds great, thanks. Take your time!

EDIT: back up and running, for some reason Tapatalk crashes when I try to upload a photo so here's the screenshot:

https://www.dropbox.com/sc/3jorn7i7pwcuqii/AAAf8XV1y3idIZP6_8Q3D6Usa
[G 2014 Android Development] DiamondBond:
* v2.0 ~ changes from luca and some from hoholee (will merge more when i can understand more lol) and memory leak fix for 5.0.2 (bootanim bin removal)