In my code, I define a NSDictionary in viewDidAppear like this:
dataDictionary = [[NSMutableDictionary alloc] init];
then later in a loadData method, I load a mutable copy of the NSDictionary like this:
[dataDictionary setObject:[receivedData mutableCopy] forKey:[theConnection description]];
Later, when I switch to a different view, I unload my dataDictionary to save memory. In viewDidDissappear, I put:
[dataDictionary release]; dataDictionary=nil;
and I also release dataDictionary in dealloc.
However, it seems that there is a memory leak related to mutableCopy, and this is the only mutableCopy that I make, so it must be from the mutableCopy shown above. Does anybody have any idea why this might be leaking? I am thinking that mutableCopy makes another allocation besides the allocation made for the NSMutableDictionary, but I'm not sure how to deal with that since the mutableCopy is inside the dictionary and the dictionary is released.
Thanks in advance...