Memory leak problem - NSConcreteData
// to set tip - photo in photo frame
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:pathOfThumbNail]];
UIImage *cellThumbImg;
if([data length]>0){ cellThumbImg=[UIImage imageWithData:data];} else { cellThumbImg=[UIImage imageNamed:@"130X90.gif"]; }
UIImageView *imgView=[[UIImageView alloc]initWithImage:cellThumbImg]; imgView.frame=photoFrame;
(cellThumbImg.size.height>=58 || cellThumbImg.size.width>=58 ) ? [imgView setContentMode:UIViewContentModeScaleToFill] : [imgView setContentMode:UIViewContentModeCenter] ;
[cell.contentView addSubview:imgView];
[imgView release];
my question is very much similar to this question,
http://stackoverflow.com/questions/280053/iphone-memory-leak-nsdata-datawithcontentsofurl-uiwebview
Even, I have added following code to my Application Did Finished Launching, given below. Following code is for setting sharedCache memory with zero capacity. It will almost remove the NSConcreteData leak in my application. However memory leaks.
- (void)applicationDidFinishLaunching:(UIApplication *)application {
NSURLCache *sharedCache = [[NSURLCache alloc] initWithMemoryCapacity:0 diskCapacity:0 diskPath:nil];
[NSURLCache setSharedURLCache:sharedCache];
[sharedCache release];
[window makeKeyAndVisible];
}
i could not find any solution for this kind of question from stack overflow.
If you can answer, i will be thankful to you.
Thanks in advance.