iPhone SDK: Memory Leak

March 25, 2009 § Leave a comment

Use Activity Monitor to monitor the actual physical memory free. Us device rather than simulator for accurate.

Be sure you use developer profile rather than distribution profile on device when running Activity Monitor.

For the button title, use [NSString stringWithFormat] instead of alloc.

Do not use [UIImage imageNamed:]

Suggested workaround:

[UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] bundlePath]

– (NSString *)pathFor:(NSString *)resourceName {
NSString *path = nil;
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *name = [resourceName stringByDeletingPathExtension];
NSString *ext = [resourceName pathExtension];
path = [mainBundle pathForResource:name ofType:ext];
return path;


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

What’s this?

You are currently reading iPhone SDK: Memory Leak at Web Builders.


%d bloggers like this: