I'm loading a series of images from a server into NSData objects like so:
for (int i = 0; i < 36; i++)
{
NSURL *url = [NSURL URLWithString:@"http://12.34.56.78/image.jpg"];
NSData *data = [NSData dataWithContentsOfURL:url];
// Further processing here
}
The problem is that half of each data object is being kept in memory. This does not show up as a leak in instruments. I know it's the NSData object because I have removed everything having to do with images and really only have the two lines before the comment now. The same behavior occurs. I've tried alloc initing and releasing explicitly with the same result.
The thing that makes this really hard to figure out is that I created a second project to try to recreate this behavior and I can't get it to do so. In the other project, this code acts as expected. So I'm asking, what might cause such behavior? I feel like I'm overlooking something extremely obvious.