The iPhone needs a big red X like Windows Mobile, errr, better I mean
My buddy Dwight Silverman of the Houston Chronicle picked up a shiny iPhone 3G and he’s been playing in the App Store like a million other iPhoneros. He’s overall pretty impressed but he points out something that most of us who’ve been using the iPhone have noticed. Dwight has done a good job describing what a lot of us have seen, that the App Store is a great resource for programs for the iPhone but that you might be installing them at your own peril.
I too have noticed that once you start installing apps and playing around with them that the iPhone gets a lot more unstable than it was out of the box. It’s not uncommon to fire up a new app and have the phone kick you right out of it back to the home screen. I’ve even had the phone reboot itself a couple of times. Read Dwight’s analysis for a good description of this. Dwight mentions that some of the new apps in the App Store may not be quite ready for prime time and that may be what is causing the problems. I think Dwight is right about that but I also think there’s another thing at play here.
From what I can gather using the iPhone it appears that the memory model is similar to that of Windows Mobile. We’ve long groused at Microsoft that when you click the red X to close a program in Windows Mobile that the app doesn’t in fact close, it just goes into the background. While I’m no expert on the iPhone my observations is it appears to be working the same way. When you hit the home button to leave a program it looks like the program is still taking up memory even when it’s closed. I’ve seen the iPhone get unstable like described without even running an app from the App Store. Try opening up several tabs in Safari with a few of them containing web pages with a lot of data and you’ll almost certainly get kicked out of the program. This tells me that what we’re seeing is that the iPhone gets unstable when it starts running out of memory, and it’s pretty recreatable a situation. So maybe it’s not the apps from the App Store so much as the way the iPhone handles memory. If that’s the case then it would behoove Apple to make sure that big programs actually close when you leave them and not just pause.










Just so you know, I have posted this same issue on the Apple Support Forum.
What you should be doing is hold down the “home” button for approximately 6 seconds and the application will close completely. In addition, the applications should close after 5 minute per SDK rules for applications submitted to Apple Store.
Just a tip.
I’ve been experiencing and thinking about these same issues as well, but I worry that the actual explanation is a bit more troubling.
Apple says that apps aren’t allowed to run in the bkg, right? When you hit the Home button, you’re actually quitting the app, which I figure *should* mean that it gets dumped out of memory. You could be right though, in that the app sticks around and gums up memory for other functions.
But what if running apps is affecting the core OS somehow and causing things to become unstable? Perhaps some apps are taking more control over core functions or not putting things back in place when they’re done. I’m no developer, but I just wonder if the core OS just isn’t quite mature enough for other apps to be poking arround and piggybacking on it’s libraries.
In other news, I typed this entire comment on my iPhone 3G.
I find that you don’t have to run any 3rd party apps to make the system unstable. Just run a bunch of native apps and you get the same effect and why I think it’s a memory issue.
I’d agree with you David, except for one thing: when you go back to an app, it returns in exactly the same state you left in. I think they’re temporarily “suspended” from running, but the memory is still in use.
Sounds to me like the iPhone really does suffer from the same memory management issues as Windows Mobile and Blackberry despite Steve Job’s keynote speech to the contrary.
The question that remains is whether it’s behavior problem as Nutsnbolts suggests– in which case, the tip should be documented more visibly; or whether it’s a true memory management issue in the iPhone itself that it isn’t behaving the way it’s intended, in which case, Apple should be prepping firmware 2.1 with a fix.
I know that on the Windows Mobile Professional side (the touchscreen versions), there are a number of programs that allow you to change the behavior of the X button. HTC’s task manager, for instance, allows you to set the X to “always close” or set it to hold-to-close. I believe the same option should exist on the iPhone.
Holding the Home button until it quits is the equivalent of ‘Force Quit’ in OSX.
Now, I’ve never seen the SDK and I don’t know squat about programming for the iPhone, but I do know something about Unix (the underlying OS for Mac OSX).
In Unix, you can close a program nicely, or you can kill it hard. It’s up to the program to act on the nice close command by cleaning up after itself and saving. Hard kills are for unresponsive or otherwise locked up applications. What may be happening is when you switch apps, you may be placing it into the background, but still in memory, so that if you switch back, it’s where you left it. If the apps are supposed to close after 5 minutes according to the SDK rules, then what should happen is that going to the background should kick off a timer thread, which after 5 minutes, calls the close/quit routine. That may not be happening. If you push and hold the home button, it may be sending a signal to all backgrounded apps to close nicely, or it may be sending a kill signal to force them to close. Don’t know, since I’m not an iPhone programmer.
It may be possible for somebody to release an app to tweak runtime settings, since most of those are controlled via stuff in the /proc filesystem and with .plist files in the /Application directories. It would be good for Apple to tweak the OS to capture application errors and write them to a log file or at least an error message, rather than just dying silently.
Hope that helps!
/Mike
Looking at Dwight’s examples and comparing them to yours, it looks like a networking issue. All of Dwight’s examples are server-based services. Loading up Safari tabs means pulling in a lot of data from multiple sources at once. If the crashes are happening when you’re jumping between notes, clock, and iPod, then that points more solidly to a memory issue. However, since the examples are all connected apps, logic points to a connectivity issue. I would compare wifi and 3G to determine if it’s specific to a network. If common to both, then it must be in the device.
You know what bothers me. There are many more tips I can share that is not documented and that is scouraging (right word?) the apple forum. The worst part, they disabled search due to high traffic. Nevertheless, here is another tip, new iPhone version!
Make sure you back up everything first.
Go to iTunes > hold the command (ctrl) key and click on restore.
5A345 to 5A347
I can’t seem to find a decent release notes but one of the fix was to correct the warm screen.
enjoy!
One more thing, the firmware or holding the “home” button down doesn’t mean it will correct the issue.
So far, I haven’t experience any issue. I have been religiously holding the “home” button down for applications that I know are “other” non-important applications I don’t need to keep running.
David:
“Apple says that apps aren’t allowed to run in the bkg, right?”
I don’t think this statement is true. They are allowed to run in the background, only for 5 minutes and it should close automatically.
Whether it’s doing it or not…you got me?
I know for one thing, I will test and try launching several applications and recreate the issue and wait like 10 minutes to see if the issue goes away, hopefully invoking the auto close after 5 minutes.
Where did I get 5 minutes from? It’s stated in their SDK submission rules to the APP store for 3rd party applications.
This is developing into a great conversation; some additional random thoughts / observations.
While Dwight may only see this with web or connected apps, I routinely see it with App Store apps that are standalone.
Apps might not be allowed to run in the background and might shut down after a pre-determined time, but I just tested something. I was reading a book in eReader last night. I shut my phone down when going to bed. The phone has been back on for the past two hours this morning. I fired up eReader and it appeared pretty quickly at the same page I left off at. It might have saved the page number, but I suspect the app never shut down. Why? Because it didn’t repaginate at all… which I’ve noticed is notoriously slow BTW. Just an observation…
I do have the latest 2.0 software; I updated it within 24 hours of putting the prior release on.
sumo, once the browser pages are loaded it’s a memory issue, not connectivity. That’s why I think it’s memory related and not connectivity.
And in case you were wondering the answer is yes. Windows Mobile users are smirking collectively.
James, I’m only going by your examples. Your use of the present tense made it sound like you get kicked out when the the pages are loading, not when they’re done.
Sumo, with multiple tabs that means the earlier pages are cached in memory no matter what is happening with the current one.
I am also a convert from Windows mobile..woo hoo…
A few more weeks and I think I will be back with all the applications I had on Windows Mobile.
On a side note, here is another tip…hold down home and power button (screenshot taken) hehehe…anyway, most of you probably already knew that.
back to the topic, I do wish there was an app that tells you what is open. Now we will get somewhere.
I had some instability for sure but a full restore seems to have fixed it. I can’t really explain it but the iPhone in 2.0 with 3rd party apps is now very smooth. The one issue I have is that loading the SMS app takes a few more seconds than I remember.
I don’t think that this is the cause of the problems. I’m currently developing an App for the iPhone and the SDK clearly states that only one application can run at the time and that your application will exit as soon as another app starts or the user receives a phone call. Once this happens the app gets notified by the system and is supposed the save the users data and the state of the app. This way it seems like it was running in the background because as soon as you start it again it should put you right back where you were. Memory leaks can only occur while your app runs (the app will also get notified when it runs low on memory). Once your app gets terminated the operating system is supposed to clean up (which it hopefully does).
As someone who has been digging into iPhone programming for months, I can say fairly definitively that leaving an app (via a normal home button press) kills it (or at least should). The app gets a slew of messages to that effect, and people have been trying hard to get an app to run in the background despite Apple’s stated intentions of not allowing it.
The SDK is pretty clear that an app gets loaded, runs, then quits. It is up to the app to save state upon exit to make it appear like it was just suspended when it loads again. Some apps probably do a better job of that than others. I’ve never seen anything with my apps that makes me think I’m not starting from scratch every time. Now, how good the OS is at cleaning up after the app (particularly an ill-behaved one) is another question.
I suspect these issues have less to do with apps truly continuing to run, but more with somehow screwing up the system when they do run. That still ideally shouldn’t happen (especially given how Apple had all that gloom and doom talk about how they couldn’t have third party apps screw up the phone and thereby bring down the whole cell network and perhaps civilization as we know it). There are also low memory messages that apps are supposed to respond to but might not. The SDK hints that bad things can happen if they are ignored, however.
I know in one of my apps I’ve managed to somehow do something so that standard UI elements are drawn in the wrong places, in the wrong colors, or even upside down. It all happens randomly, and fairly infrequently. I’m sure I’m doing something wrong somewhere, but still it hardly seems that these apps are as sandboxed as they first appeared to be.
I think the real issue is that we have a lot of apps that were rushed into the store without adequate testing. The “final” beta SDK only came out a few days before the deadline for the App Store rollout submissions. I can’t see how anything but the simplest app could have been vetted properly. Apple also has let a few slip through that weren’t even using approved SDK frameworks, so their screening process is clearly imperfect. The better, more experienced, programmers probably had a good shot of doing it right, but the new players joining the iPhone app gold rush had (and probably still have) a lot of hard learning to do. Unfortunately, this means we early app adopters will probably have to deal with this mess in the meantime.
It’s been all over the Net that this version of the iPhone OS was rushed and there are a bunch of fixes being made with an update soon to come. Not that that will fix *everything*. I suspect memory might be a persistent issue. I wonder how large the iPhone’s heap is? (Shades of PalmOS 5!!!)
Hey, I’ve had Safari go south on me when I’ve fondled it at an Apple Store. What makes it less than a terrible experience than when the 770 did that is that re-opening Safari puts me right back at the last page I was at. At most, it takes 2 seconds to resume what I was doing.
I think the iPhone is not for you, James. Better send it to me. Ha!
James, I know that’s what happens when you have multiple tabs open, but from your description, I got “open, open, open, open, crash” not “tab 1 loaded, tab 2 loaded, tab 3 loaded, try another tab, crash”. Those are different situations. Now I see you’re dealing with an overload issue, which should be addressed with better management. You should get a warning before you’re about to overload the memory, not a crash after you do so. That said, I don’t see where other apps factor into it.
RandomiPhoneDeveloper: brilliant statement; spot on.
I have read through a lot of documentation on what is suppose to be going on, but that does not mean it works that way in the real world. However, there are some basic things that are suppose to occur.
When you hit the home button, the application you are running is terminated. All memory allocated to that application is released and the application is no longer running. That is why it takes just as long to open the application the second or third time as it does the first. Just try opening the same application back to back.
While you are running the application, the programmer has to manage memory appropriately as in detailed in a number of technical documents. The documents repeating recommend to releasing objects and deallocating memory when not needed. As noted in a previous comment, the application is notified by the OS when memory usage is getting too high. The programmer is suppose to respond to this notification by releasing memory wherever possible. If the programmer ignores this notification, the application will be terminated by the OS when memory usage runs away. Unfortunately, if memory usage increases too fast, it might actually restart the iPhone. This has only happened to me in Safari. This does not surprise me since Safari is probably a memory intensive application. I mean, check the resource usage on your browser on the desktop. It is high.
Anyway, it is obvious from the documentation that memory management is a big concern, so it would not surprise me if this was causing most of the issues people are experiencing. At the same time, I have been experiencing more problems in Safari since updating to version 2.0. Thus, I would imagine there might be more going on in the background of 2.0 to handle the push features and other things included in the 2.0 firmware. Thus, memory problems might raise their head a little quicker than before.
Just another data point.
I have had the same problem when opening up some larger web pages in Safari eg http://www.smh.com.au often crashes even though it’s one of the most popular web sites in Australia.
There is definitely an issue with memory management along the lines discussed above.
There is also at least one app that I have on my ipod that was not ready for prime time. Apple need to tighten up their approval process for sure.
Just a quick update. I started having applications quit out on me. I kept trying and trying to launch it but it just wouldn’t launch. I waited approximately 10-15 minutes before trying again and everything started working again.
What does this prove? I don’t know really? I guess I’ll just keep trying to check this out to see if it will work.
as someone who has wrote a few Windows Mobile programs. The memory model is interesting. The SDk states that a well behaved app must always be prepared for termination by the OS.
Specifically, if the OS tells an APP “you need to close now cause i need your resources” the App must save it’s current state and close.
And.. well behave apps don’t just quit when there’s not enough memory. They’ll issue a request to the OS to say I need X MBytes of memory and the OS will go around shutting down apps in reverse usage order.
Unfortunately not a lot of people make well behaved apps
I always figured that the reason applications stayed open insteaed of closing when you click the X button was because that the cost of reading the code from ROM and placing it in executable RAM was much more expensive then just leaving the application idle in the background. Remember, the OS was designed back in the days when it costs a LOT of money for a measly 16MB of Flash Ram.
nutsnbolts: an app that tells you what’s open? you mean something like… a task manager? that’s crazy talk! weren’t they laughing at the idea of the task manager in windows mobile back at wwdc, about how inelegant it was? noooo, there’s no need for anything like that.
What I mentioned earlier: iPhone 2.0 not yet fully baked:
http://justanotheriphoneblog.com/wordpress/2008/07/17/iphone-20-software-whats-the-opposite-of-rock-solid/