Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all.


In my i Phone app, tehere are soem mem leaks the instuments detected.
However its showing soem "ODD" lines when i trace the line from INSRUMENTS.

Sometimes its showing the lines like

Code:
@finally    // finallly block

Code:
} // closing brace

But i conccluded that the error is with the line above the specified line (which make sense)...

Also i found that the leak is for the line where i assign the image for the cell of my UITableView.
Code:
cell.image = [UIImage imageWithData:[NSData dataFromURL:[I]myImageURL[/I]]];

The INSTRUMENTS showing leak for class NSURLResponse in this line.

Also there is a leak for..
Code:
recievedNSMutableData = [NSConnection sendSynchronousRequest:[I]request[/I] response:[I]&myNSMutableresponse[/I] error:[I]&connError[/I]];
[/CODE]

Plz help...
 
If you want to rule out autoreleased object weirdness, try explicitly allocating and releasing instead.

So, instead of [NSData dataFromURL:myImageURL]; use NSData *foo = [[NSData alloc] initWithContentsOfURL:myImageURL];

Instead of cell.image = [UIImage imageWithData:foo]; use UIImage *bar = [[UIImage alloc] initWithData:foo];.

Then, you can pass bar to cell.image, and then explicitly release both it and foo. This is assuming that you have use the retain attribute when declaring the image property.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.