Memory Management

>> Modern computer languages use garbage collection (GC). A GC is a runtime algorithm that scans the allocated objects in our program and de-allocated the objects that we have loss contact.

>> Concave under the I phone a doesn’t use GC. So concave applications must used managed memory application running an this plat form should clean up after use since I phone apps run in a memory con train environment.


If you want to become a IOS Certified Specialist, then visit Mindmajix - A Global online training platform: IOS Development Training Online”.  This course will help you to achieve excellence in this domain.


Keywords for memory management:

1. Retain
2. Release
3. Auto release
4. Copy
5. Auto Release Pool
6. Drain

1) Retain:

This is specifies that you are instead in putting a owner ship client on the object if the color release the object it doesn’t de-allocated because you retained it. Increases the retain count ‘1’

Syntax:- [obj retain];

2) Release:

Subscribe to our youtube channel to get new updates..!

We call release when we use done using on object we are no longer owner of the object. So reference count is decreased by owner.

  • If the reference count is zero [no owner left]

Then the object is automatically deleted and memory is freed otherwise the object states in memory for other owner to use.

Syntax:- [obj release];

3) Auto release:

This means that you need the object temporarily, and doesn’t make you an owner.

It just like saying I need this object is noun keep it in memory while I do a few thing with it then you can delegate it.
object code

4) Copy:

This object creates a copy of the objects and you become a owner of the new object.

Syntax:- Ns string *str= [str2 copy];

5) Auto release pool:

An auto release pool is an instance of ns auto release class and defines a slope for temporary objects [objects which are to be auto release]

  • Any objects which are to be auto release (objects we send auto release message0.
  • (Created with convenes methods) are added to the current auto release pool when the auto release pool is release all objects that were added to it are also automatically release.
  • This is simple way of managing automatic release for objects which are needed temporarily
  • Auto release pool can be nested in this case all auto release objects are added to latest the pools are stored in a stack

NS auto release pool * pool= [(NSAutoReleasePool alloc]int];
//str is auto release object adding to the pool.
Ns string *str = [NSString  stringwithstring:@”Hai”];
// when release pool it sends release message to all objects of its;

6) Drain:

When we pass drain for object it deal locate the all the objects in a pool.
Ex:- [pool drain];

Distribution of Iphone app

In preparing your device to install an Iphone apps we have to create decertificates.

  • CSR
  • Development certificate
  • Provisioning/distribution profile
  • App id generation

a) CSR (certificate signing request):

It contains information used to generate your development certificate this certificate is development in key chain is present in MAC os

 development certificate

b) Development certificate:

A development certificate identifies an IOS application developer after the csr is a approved we download developer certificate from the portal and added to the key chain.

  • When we build the application with x code it looks for your development certificate in your key chain.
  • If it finds the certificate x code sign your application otherwise it give build error.

c) Provisioning profile:

It is generated from portal whenever we install provisioning profile and I phone the device becomes alive for developing application through x code.

  • provisioning profile is a individual user
  • Distributing profile is a many nor of user

Eg:- USA friend

Device registration: Apple provides 100 devices testing for standard program every I phone as unique device it is  a 40 digit nor you should registered this in portal.

d) App id generation:

Every application has unique app ID it is also generated from portal.

Note:- Distribution of over app to the device can be done through distribution profile, and we should convert over final product app file IPA this over distribution is called ad hoc distribution.


Frequently Asked iPhone Interview Questions & Answers