Hi Guys,
I am having issue of memory leak for NSString stringWIthForm
Below is code written in function which call on Onviewdidload event. Function load photo asynchronously from server, first time load I didn't get any issue but as I move to another view (using navigationcontroller) and come back to same view showing multiple memory leak (size of photos array).
I have tried with [NSString alloca] initWithString and release at end of loop but still not work.
Can anyone help me to find out where I am going wrong and where it is leaking exactly?
Any help will be appreciated..
PHP Code:
for (NSArray *photo in photos) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString *strURL = [photo objectAtIndex:[self indexByColumnName:@"FILENAME"]];
NSString *strThumbURL,*strFormattedURL;
if ([strURL hasPrefix:@"http"]) {
//Cloude hosted photos
strThumbURL=[NSString stringWithFormat:@"%@/th_%@",[strURL stringByDeletingLastPathComponent],[strURL lastPathComponent]];
strFormattedURL = [NSString stringWithFormat:@"%@",strURL];
}
else{
strThumbURL=[NSString stringWithFormat:@"%@%@/th_%@",WEBSERVICE_URL,[strURL stringByDeletingLastPathComponent],[strURL lastPathComponent]];
strFormattedURL = [NSString stringWithFormat:@"%@%@",WEBSERVICE_URL,strURL];
}
NSURL *url = [NSURL URLWithString:strThumbURL];
thumbView = [[ThumbImageView alloc] initWithURL:url];
[thumbView setDelegate:self];
CGRect frame = [thumbView frame];
frame.origin.y = THUMB_V_PADDING;
frame.origin.x = xPosition;
[thumbView setFrame:frame];
[thumbView setImageURL:strFormattedURL];
[thumbScrollView addSubview:thumbView];
[thumbView release];
xPosition += (frame.size.width + THUMB_H_PADDING);
if (i==0) {
[self pickImageWithURL:[thumbScrollView.subviews objectAtIndex:0]];
i++;
}
[pool release];
}