Sjakelien
Sjakelien

Reputation: 341

iPhone: Can my Leaking App harm other apps?

So, I finished writing my first iPhone App, and I have sent it out to a group of beta testers. Everybody is happy, except for this one guy who noticed that after having run my app, another app is not starting up anymore.

Not knowing too much about memory management, I started looking at the Leaks graphs in Instruments, and noticed, that there are some leaks going on in my app.

Three questions:

  1. Are leaks always bad? The biggest leak is 15k on a total of 5,1 MB allocated memory.
  2. Will Apple refuse my app because of leaks?
  3. Is not all the memory automatically freed up as soon as my app quits? Could it be that my leaking app is harmful to other apps?

Thanks Sjakelien

Upvotes: 4

Views: 918

Answers (5)

Matt Bridges
Matt Bridges

Reputation: 49435

Each app is supposed to run in its own "sandbox," and is by design not supposed to affect any other app installed on the phone. If your reviewer found a case where your app really did affect another app, that's definitely not your fault, although I'd love to know how that was accomplished ;).

My guess is, though, that your reviewer's other app broke completely independently of your app, and he/she is spuriously attributing the fault to your app. Ask him to try to reproduce the problem (uninstall both apps, install the other app, install your app).

Upvotes: 8

dredful
dredful

Reputation: 4388

Apple does approve apps that have memory leaks.

That said, we thoroughly check that none of "our code" leaks before submitting to Apple because users don't like having an app suddenly shut down on them. I say "our code" because there are memory leaks in the framework that are not your doing. Thus Apple approves apps with memory leaks.

Also, I am doubtful your app has adversely affected the user's other app. I have not seen that behavior.

Upvotes: 1

It depends on what "memory" you are leaking. Are you using device storage space to cache something? In theory then it's possible that you've used up enough space the other app cannot start because it needs a certain amount of free space.

If we're talking physical memory, then no. When your app is dead it is dead. You could ask them to restart the device and see if they have the same issue.

Upvotes: 1

davidivins
davidivins

Reputation: 320

what the other two answers say i agree with, however nobody has answered the first question ("Are leaks always bad") directly. i would say that yes they are. it's true that your program can possibly run with them for long periods of time without issue. and the OS should clean up the memory after termination (unless there's a bug in the OS, as said before). but eventually the leak will become an issue for someone at some point when they run long enough. also, even if it doesn't become an issue, it's probably a best practice to always fix memory leaks that you know about.

Upvotes: 5

Gordon Childs
Gordon Childs

Reputation: 36159

Any leak that persists beyond the exit of your application is an OS bug, and hence Apple's problem.

It would be unfair to reject your app on this basis.
I don't know if that's any comfort to you.

For the record, my app provokes a leak in mediaserverd.
The leak is a tiny bit smaller in the 3.0GM.

Another incorrect usage of an API crashed mediaserverd.
Also 3.0GM. Nasty. I'd have preferred an error code, however
this could theoretically be used to work around the leak.

Upvotes: 3

Related Questions