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

shilpa

macrumors member
Original poster
May 29, 2008
33
0
Hi all,
in my app

NSAutoreleasePool *pool = [[NSAutoReleasePool alloc]init];
cell.image = [UIImage initWithData:[NSData initWithContentsOfUrl:[NSURL URLWithString:mad:"http://images/image.jpg"]]];
[pool release];

when i see leaks in instruments and after tracing stack it will come and stop to this line:
cell.image = [UIImage initWithData:[NSData initWithContentsOfUrl:[NSURL URLWithString:mad:"http://images/image.jpg"]]];

NSAutoreleasePool *pool = [[NSAutoReleasePool alloc]init];
i didnt had this line in my code earlier ,after geeting the leaks i added this line
but still leaks are there in my app.

Not only here i am parsing xml files in my app,where ever i use NSURL there are leaks in my code.

NSXMLParser *parser = [[NSXMLParser alloc] initWithURL:[NSURL initWithString:URL]];
 

Enuratique

macrumors 6502
Apr 28, 2008
276
0
Looks like you and sujithkrishnan are having the same problem.

Unfortunately no one has come to his rescue either. Could it be the URL not being freed? Perhaps there is a bug with NSData or UIImage? Sorry, without seeing more of your code, I can't tell what else could be going on.
 

Mac Player

macrumors regular
Jan 19, 2006
225
0
initWith methods are instance methods not class methods and the don't return auto released objects you must release them manually.
 

pjrobertson

macrumors 6502a
Nov 14, 2007
533
4
Not sure if I can help...I think I've just read about this in Stephen Kochan's book -

But how do you free the memory used by your origin? Freeing the rectangle's memory does not also
free the memory you allocated for the origin. One way to free the memory is to insert a line such as
the following in main:
[[myRect origin] free];
This frees the Point object returned by the origin method. You must do this before you free the memory
for the Rectangle object itself because none of the variables contained in an object are valid after its
memory is released.
(Taken from "Programmin in Objective - C", please remove if copyright infringement :eek:)

So maybe you need something like:
[[pool object] release]
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.