kingston
kingston

Reputation: 1553

memory leak in iphone

i m getting a memory leak...

at this particular statement

[item setObject:self.currentTitle forkey:@"title"]; ...

i have released the memory at dealloc function for item and curentTitle is declared as

self.currentTitle=[[NSMutableString alloc]init];

but still showing leaks

Upvotes: 0

Views: 111

Answers (2)

EmptyStack
EmptyStack

Reputation: 51374

You can use the convenience method. self.currentTitle = [NSMutableString string];

Upvotes: 1

Macmade
Macmade

Reputation: 53960

How is your property declared?

If it's declared as retain, there you have your memory leak...

@property( retain, readwrite ) NSMutableString * self.currentTitle;

You should do, in such a case:

self.currentTitle = [ [ [ NSMutableString alloc ] init ] autorelease ];

Upvotes: 3

Related Questions