Pratik Mistry
Pratik Mistry

Reputation: 2945

Deallocate all memory used by my iOS application if application crash unexpectedly?

I am beginner in iPhone App Development. Sorry for silly questions.

Consider a case that if my application crashes without any warning then all the memory allocated by my application will be freed automatically by iOS or is it stay as it is?

If not released by iOS then how and where can I release them?

Upvotes: 0

Views: 150

Answers (4)

wod
wod

Reputation: 812

I preferred to began working in ARC (Automatic Reference Count) also it works in iOS4 & iOS5

Upvotes: 0

Eelke
Eelke

Reputation: 22033

Yes any decent OS frees all memory and releases many other resources like file handles used by a program when that program terminates. It doesn't matter how the program terminates. One important thing to note is that the OS reclaims the memory without releasing/destroying your objects. So any code that normally would be run automatically when an object is cleanly released won't be called when the OS reclaims the memory on program termination.

Upvotes: 1

HelmiB
HelmiB

Reputation: 12333

There's nothing you can do if your application crashed. By the time app crash, system will destroy allocated memory the particular app. When application start again, there is no allocated memory, and your application will start fresh.

You should manage your memory in your application properly, see: this or Apple Doc

or you may try ARC, see this tutorial

Upvotes: 1

NiravPatel
NiravPatel

Reputation: 3260

you will have to release your global(decalred in .h file) objects in dealloc method that is

-(void)dealloc
{
   //release here
}

your private or instance objects you can release after it is used.

Happy Coding!!!!

Upvotes: 0

Related Questions