Ask Slashdot: Getting Apps To Use Phones' Full Power?
First time accepted submitter MurukeshM writes "I have a 16 GB Nexus 4. I rarely manage to push the RAM usage above 1 GB (not counting cached processes). Yet I find it increasingly annoying when apps do stuff to save on RAM usage, such as having a browser reload a tab if I havent used it for a long time, instead of keeping it in memory or have an ebook reader load from storage instead of keeping the entire eBook in RAM. I know there are plenty of phones with far less memory, but when most of the RAM is unutilized, with more and more phones and tablets having 1GB+ RAM, isn't it time that apps check on available RAM and use optimizations accordingly? And it isn't only about RAM. Android by default only downloads one thing at a time, whether it be an app from Play Store or a file from a site. When connected to WiFi or 3G/LTE, there's no reason why multiple simultaneous downloads shouldn't be used. How do Slashdot readers with high-end phones get the most out of their device? Are there custom ROMs which act more sensibly?"
The 16GB Nexus 4 doesn't have 16GB of RAM. It has 2GB. Your post reads like you think it has 16GB of RAM.
Just a note for future articles:
I have a 16 GB Nexus 4. I rarely manage to push the RAM usage above 1 GB
There is no need to include "16 GB". Both devices have 2 GB of RAM. To someone who doesn't know this, the summary might imply that they have some awesome 16 GB RAM model.
All my liberal friends think I'm a conservative, all my conservative friends think I'm a liberal.
You are running a device capable of running many simultaneous tasks, you can't have all of them decide to use every bit of RAM or disk space. It's up to the OS to maximize resource allocation and minimize battery usage.
When connected to WiFi or 3G/LTE, there's no reason why multiple simultaneous downloads shouldn't be used
If bandwidth is finite, serializing downloads means one finishes first, and can be used while the others download.
You're right on the RAM usage, however - particularly with eBook readers. It's reasonable to keep them in-RAM, or at least keep enough in-RAM so you can turn a few pages forward or back without loading.
This is a platform that was not designed to have a scheduler carving up resources. If you want a mobile device that makes good use of the available resources (and somehow manages to try to conserve power while doing it) ARM isin't where you're looking. (ARM in clusters: awesome idea. great power efficiency at performing simple SINGLE tasks while other units perform simultaneous threads.)
And re, cell network: There's physical problems with trying to maintain high data rate, low latency, long range connections (especially at low power) It's a miracle it works at all in most cases. :P
I only use that phone about 9 days per month, but it is becoming less and less useful as time goes by because of this memory usage issue.
A few months ago I moved the Dalvik cache onto an Ext3 partition and it helped somewhat. I still have over half of my apps moved to the SD card because everything will not fit.
Developers, please continue to try to optimize your applications for older phones.
Thank you.
The problem with ram is that you can't do that. Unfortunately traditional apps live in a world where memory can't be "taken back". By taken back I mean that precisely as you request, an app could have a minimum requirement of 10MB, but maybe it could cache stuff for 1GB. However, there is no easy way to the OS to tell the app politely "hey, may you please give back as much memory as you can because something else needs it?". The problem is two fold for mobile apps: they may be "thawed", so they are not really executing to save CPU, so they can only be asked if they are currently running. And second, the memory another app is asking, is it because it requires that memory to work, or it also wants to create a big cache of discardable stuff? You see, malloc et all don't have an option to say "I want this much memory but I don't really need it, so don't purge other processes form memory if there is none available".
The end result is OSes have to deal with killing apps to free memory because they end up over allocating memory. And especially if you consider all of the above to be for well behaved apps, you can surely understand apps could DOS your OS if they could get away with hogging available memory for themselves...
Just so yo know...
two minutes googling would tell you that the available RAM is only 2GB, what is this newbie crucifiction week?
I've got some photographs, I'd like to show them to you. Though you don't know the girls You'll recognise the view..
I recently upgraded from a very old Android(300M of RAM) phone to a Nexus 4 and it amazes me how long it will keep an application at the same point. On my old phone, it recycled memory so quickly that going from an app, to home, and then launching calculator or something and going back to the app, it would be a fresh session. On the Nexus though I've launched an app in the evening with it keeping the same state that it had in the morning when I launched it without reloading anything.
That being said, YES it is extremely annoying that it only downloads 1 thing at a time, despite clearly being capable of downloading many things at once. (oddly enough this rule is kept in place when downloading with Chrome as well)
This is a developer's issue here. The optimizations you talk about take a long time to implement and how would you determine these types of things on the fly? Minimizing ram usage is the regular method for programs. I don't know which programs you are using, but most of my phone's apps are 50mb or less. So I could basically open every app on my phone simultaneously and still have a bunch of that 1 GB memory left. As for multiple downloads, you could download two at 50kb/s or one at 100kb/s. Does it really even matter?
I run Cyanogenmod on all of my Android devices (currently Galaxy Nexus for my main phone, Nexus 7 tablet, and an older HTC G2 phone for playing around with), and have never looked back.
As others have mentioned here, though, sounds like you may not fully understand what's going on, since the Nexus 4 doesn't have 16GB of RAM, and we all seem to be able to do multiple downloads at once.
LegendMUD
You suffer from a common issue, but simply put programmers tend to make apps for the lowest common denominator and its easier to operate under the assumption that a users device has limited resources for most apps than to manage RAM proactively.
Two things:
1: The poster is fully aware of the proper lyrics. It's a copypasta troll, and you just swallowed the hook down to your kidneys.
2: Of course Betty's next. She's the last one.
Dear Slashdot:
I bought this Ferrari and I live in a suburban part of the US. I can't drive it over 70mph on the highways and I'm constantly in stop and go traffic in the city. It's so frustrating!
Can anyone of you tell me how to get the most out of my car?
Minimizing ram usage is the regular method for programs. I don't know which programs you are using, but most of my phone's apps are 50mb or less.
I want to open a bunch of web pages in tabs while connected to Wi-Fi, hit the road, and then being able to display each page without having the device purge the page from the cache and try to reload it from a data connection that doesn't exist. There's no Wi-Fi on city buses. One reason I carry a 10" laptop instead of a tablet is because web browsers designed for laptop operating systems are historically better at this use case.
As for multiple downloads, you could download two at 50kb/s or one at 100kb/s. Does it really even matter?
It does when the one download is failing to saturate your downstream because the server is limiting one to 50kb/s.
Seriously.
I've learned that swiping the app offscreen to the left doesn't 'force stop' it, it just removes the icon from the 'running apps' list.
Doing a 'long press' on the apps icon brings up a sub-menu of 2 options, "remove from list" and "app info". Tapping on the 'app info' shortcut brings you to the 'app info screen', from there the app can be 'force stopped'.
I'm posting this here in the hopes that it'll clear up any confusion caused by that previous discussion. :-)
Certain apps (like the play store) download one at a time because they are trying to be nice on your phone (since the time saved from multiple downloads is negligible anyway, unless you have a really good 4G signal).
When I'm downloading a bunch of applications to my tablet, I have better than 4G: I have Wi-Fi with a wired upstream.
The problem is that about Froyo, when app2sd functionality was rolled into the OS, onboard memory was EXPENSIVE and SD was cheap, so there was a deliberate design decision to avoid letting non-system apps take over program memory. Even back then, this was a less than acceptable idea, as there were different ROM and RAM totals (okay, onboard storage and program memory, yeah, the're not QUITE ROM/RAM) even then, so a given app could use all RAM when running and still have a very small footprint in ROM, putting all its storage on SD. Even now, with your 16 GB nexus that has 2 GB program memory, you see that issue, albeit not so much. Once upon a time, it used to be said that you had three things that could be traded for each other, storage, memory, and processor, and that still applies today. I just think Android is making a very bad choice in what to trade. The real thing that would help this issue is if someone went through all the android appstores and took a damn optimizing compiler to everything, if you look at what should be computationally easy things, they invariably want entirely too many resources for that they really do. It really wouldn't surprise me to see a "shopping list sorter" that took up 2GB of storage, for example (even a bogosort shouldn't take THAT much resource)
Just because you're paranoid doesn't mean they aren't out to get you
An Android device may have 2GB of RAM, but each app is only given something like 24MB to 48MB dependent upon the device manufacturer. That is why it is so easy for a particular app to run out of memory if the developer doesn't manage allocation well.
"Hold me closer, Tony Danza..."
- - -
There's a bathroom on the right.
There is an 'Ask Slashdot' section for a reason. Please use it!
Thanks.
Fnord666
'The tyrant will always find pretext for his tyranny.' - Aesop's Fables
I've been a programmer for a long time, and one thing that has always bothered me is the amount of crap programs put in memory. Years ago, it was a general rule to put only what was needed in memory, and write your code as efficiently as possible to increase the performance and allow your program to work on larger data sets than might normally be possible with the memory limitations at the time. Then computers got faster and had more memory available, and the old programming logic was thrown out the window and programs became too bulky and loaded with extra crap that eats up too many resources. I have checked the memory footprint of multiple programs on windows and have found that one of my chat programs uses roughly 10MB of memory while it is running, and another one uses roughly 130MB. The 130MB program is prone to crashing, is much much slower, and doesn't really offer any benefits over the program with the 10MB footprint.
So using more memory shouldn't be a measure of how well a program works, and I would argue the opposite in most cases! The 16GB of internal storage in the phone should be more than fast enough to read the data the user will be interacting with. Provided the program code is efficient and uses very little memory (which is should), accessing the data to display on the screen should be nearly instantaneous. If the ebook reader is that inefficient, don't blame the OS from trying to protect itself and other apps from garbage coding.
I bet if your ebook reader was written in assembler it would use barely a fraction of the memory it currently uses, and would be lightening fast. In that case though, it would also probably look like crap, would take a very long time to code, and an even longer time to fix bugs when/if they show up.
That even let this post through?
16GB of RAM? Who seriously thought that that phone had 16GB of RAM? My fucking developer workstation doesn't even have 16GB of RAM!
Sheesh.
I agree with you (and MS) that Free RAM is wasted RAM. Probably upcoming versions of apps will check if they need to swap/release before doing so ?
As for "When connected to WiFi or 3G/LTE, there's no reason why multiple simultaneous downloads shouldn't be used." Yes there is: whatever is limiting the speed of your download/install (it(s not instantaneous yet, is it) will also impact simultaneous downloads. Plus thrashing.
The Cloud - because you don't care if your apps and data are up in the air.
I have 384 MB of RAM on my Droid Charge. Task Manager reports 368 total, so some has disappeared.
Of that 368, 236 is taken up by the OS and Verizon bloatware which, if I kill it, gets restarted.
I don't need 30 things sucking up 5 meg each.
(-1: Post disagrees with my already-settled worldview) is not a valid mod option.
Oh that's good to know. I wish I had mod points. I always thought swiping the app away meant "I am not going to use that, you can unload it" which would be a nicer version of force stop.
If is specifically about android and dalvik apps you won't have available all hardware power for your app. I would go to native apps either in Android or some other linux based OS for that kind of things, and of course, native apps for those OSs (development could be done in QT/QML for most of them, porting between them should not be so hard)
What does this have to do with anything at all?
In the mentioned situations I believe it's mostly the OS that's to blame, more so than the app.
If I were to develop an e-reader app, that reads a book from a file on disk, I would just open the file, and start reading the needed parts from it. Most modern OSes will then cache the file in RAM, or at least start reading ahead as much as possible, after all if the first bytes of a file are read, it's likely the following bytes will be read in the near future, and if not this memory can easily enough be overwritten by something else again. An app shouldn't even try to do this - it shouldn't try to fill up the memory - let the OS take care of that part. Resource management is an OS task, not a userland task.
An app should try to minimise direct resource use, that will generally speed up things overall. For example reading the whole e-book from disk and storing it in RAM will cause the process to grow big, and more likely to be killed to make space for other processes, so a next startup takes much longer. It growing so big also means more other processes have to get killed when the reader app is used, just to make space.
And yes I use "disk" here knowing full well that in a phone that's usually some kind of flash memory or SD card or whatever.
[ My vote for dumbest line in the last Star Trek movie. ]
It must have been something you assimilated. . . .
Could we just give the OP the benefit of the doubt that he simply just misspoke? It seems like he has a legitimate question, and instead the discussion is getting lost in a bunch of crap posts all saying the same thing about the 16GB. Jeebus, people.
you can tell that charger isn't putting out the 1 to 1.2 or whatever Amps it does if an iPad was plugged in.
And do you really think your Samsung charger would attempt to assassinate whatever was plugged into its USB port with way more amperage than the USB spec states will be delivered over the port?
This is exactly why I think it's so absurd that people complain about "custom" connectors (never mind USB itself has about five!), when in order to charge devices in a reasonable time over an ancient standard, we instead live in a world of custom chargers that just happen to PRETEND to use the same connector type when they really behave differently depending of what is plugged into them.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
The Dalvik Virtual Machine has a heap memory limit (dependent on various things) well below the maximum memory for your phone - one example of this problem is here: http://tordtech.blogspot.ca/2009/09/memory-limit-on-android.html
This article also contains a solution for your problem. I haven't tested it myself, so I'm really sorry if you brick your phone. If you don't know C++, try this:
1. Learn C++
2. Reread article.
All in all, I would rather live with the inconvenience than go to the trouble of recompiling Android, but if you really care, there you have it.
Maybe this is the right place to ask this question:
Is there any way to force Chrome on my Galaxy Nexus to either fully cache the current page so it can display it instantly upon browser startup, or to not reload it when I start the browser and show me a blank screen?
It's annoying to start up the browser when I last was viewing a large, complicated page, and then I have to wait while the browser tries to reload and display that page, even though I want to go to a new page. Even if I hit the stop button, I have to wait for the browser to finish up what it's doing before it will stop.
It's not that I'm memory constrained, even if I reboot the phone to get most apps out of memory, open the browser and go to a page, go back to the home screen, then back to the browser, the browser downloads and redisplays the current page.
Just gimme gimme gimme gimme fried chicken
It's not April 1st yet. What gives?
most people don't have anywhere near [50 megabit per second wired service] for their home/office, but can get it through 4G.
A 50 Mbps downstream is fine for the first 800 seconds, after which it drops to 0 Mbps for the rest of the month because the customer has hit the 5 GB/mo cap. The advantage of wired is that the cap is 50 times as high: 250 GB/mo, not 5 GB/mo.
you basically need to saturate the google server sending you the app
It's not just Google Play Store. If I'm downloading a bunch of files through Chrome, I want to saturate multiple servers, most of which are not operated by Google.
What if you're the one being trolled, and that was actually the same poster? (Dun, dun, dun....)
Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
As far as I can tell, swiping away does exactly that.
We hope your rules and wisdom choke you / Now we are one in everlasting peace
Is not much of what the OP complaining about an attempt to preserve the phones battery life?
I am very small, utmostly microscopic.
Bad example. That's actually what Freddie sang.
It lives on only as a cached process, not as a live one. Those are reaped whenever anything else would use the resources they're using -- it's not _truly_ stopped, but it's a functional equivalent for all reasons that matter (unless it's your intent that your application lose all its state -- this can be useful if you're trying to clear a bug, for instance, but will have no effect on performance on the rest of the phone).
Now we have stories from dribblers who think the more RAM an app uses (like this idiot even knows what RAM means) the better. Oh, the pain, the pain!
Taking this cretin seriously, Android uses the RAM (although this cretin thinks the flash storage is the RAM) in various ways, like all modern OSes. Actually moreso, since the RAM also has to serve as dedicated storage for the GPU. On a 2GB RAM system, Android might only want to set aside 1GB for the apps themselves, although all this is controllable via deep configuration settings.
Now take the idiots specific complaint- tabs that need to be reloaded. The biggest problem with browsers on the desktop is run-away memory usage precisely because Google and Mozilla use the worst programming methods in Chrome and Firefox. The first thing any user does is install plug-ins that release memory from most of the tabs.
We want memory efficient apps. We need memory efficient apps. We should demand memory efficient apps. And when memory efficient apps are delivered, we should fall to our knees in praise.
Apps that use memory like crazy also use the worst approach to data-structures and algorithms. They are coded by the worst illiterate programmers, who get by on the fact that most computers have insane resources today. Not only do such bad programmers waste memory, but their apps will be buggy and very slow when used in anything but the simplest way.
Take the 'loaded tabs' problem. Obviously the tab being viewed by the user is active, and using RAM. However, how is the browser supposed to guess which of the other tabs is likely to be used by the user next, so that tab can be in RAM as well. The best method- never used- would allow the user to set a hard RAM limit for the browser, and have the browser implement state-of-the-art memory management. Then the user is given 'keep tab loaded in RAM' explicit controls.
The user that sez "please apps, automatically bloat into my entire RAM pool" needs shooting in the head.
Check our V6 Supercharger by zep. It is amazing, re-defines the way android manages memory to customize for you while being smarter and more efficient.
Sadly google hasn't changed the way android memory management and multitasking works since basically froyo, which makes no sense because now devices standard have at least double the RAM and cpu they did back then.
Part of the V6 Supercharger, is "Maximum Multitasking Mods" If you look into this, i think it will be exactly what you want.
I can keep 70 apps in memory, for 24 hours. Where google will cap it at 15, and not let them go back 30 min's or an hour if inactive.
Make sure to read the OP in the thread on XDA, can be a complicated process for new people, but i never had any trouble. Super quick once you get the hang of it.
Why on earth do you want apps to use more resources than they need and drain the battery faster? If you have a specific request for a specific app, get in touch with the author and ask, otherwise your question is pointless.
I'd much rather flip this question around and ask why we can't have apps codes to more limited requirements. A benchmark for high, medium and low power usage would be genuinely useful. Knowing which apps are power hogs and will drain my battery would be great, and conversely knowing an app has minimal requirements will give me more confidence in letting it run in the background.
On those Android phones which have user SD card slots, I wouldn't mind allowing the phone to page memory to the card at all if it saves on bandwidth. For internal flash... definitely not.
I already cycle about a gigabyte a day through my 16G microSD card just from DogCatcher. Another few hundred megabytes wouldn't make a dent and those cards are pretty cheap anyway.
However, allowing paging on any machine can lead to big trouble in the form of thrashing. It probably isn't reasonable to implement that sort of feature as a default on a consumer phone.
At least in the case of browsers the default memory limits can clearly be increased.
-Matt
When i talk about using my mobile or tablet as a small server for books, audio etc, people think that is silly. My phone is more powerful then the computer i used to host my IRC node in college, yet the idea of it serving anything (besides all the personal data it generates about me) is completely ignored. The entirety of mobile right now is bent on knowing EVERYTHING that goes on in the device, and you have no access to it. I have an iphone 4S and an Ipad 2. One has cellular, one doesnt. There is NO NATIVE WAY to transfer data from one to another. If i want to pull something off my server with the cell connect, i cannot then view it on my ipad. I find this extraordinarily unacceptable at this stage in mobile.
Good-bye
I know this is probably bound for Mod'ed-Trollville, but the in app memory management APIs are leagues better on iOS (for context, despite my nick, I write code for both Android and iOS).
iOS is much better about letting an application use memory heap without concern, and it has APIs to handle this exact situation. Applications on iOS manage caching (due to the Apple provided caching and memory APIs) based on the device running out of available memory over all processes, not arbitrary limits.
If we are too lazy to call software by the word application, then perhaps we should focus our technologies on fixing the retard in our brains?
I'm getting a Blackberry Z10. Should be at my house in a few days.
It keeps the last 8 opened apps open. So problems with the web browser as stated by the OP are GONE.
FWIW: Droid 3 is going bye bye. I considered the GS4 and decided that for what i do (e-mail and web browsing mostly), the Z10 is a superior product.