LLVM : spurious memory-mgmt warnings with "Copy" methods
LLVM : spurious memory-mgmt warnings with "Copy" methods
- Subject: LLVM : spurious memory-mgmt warnings with "Copy" methods
- From: Jerry Krinock <email@hidden>
- Date: Tue, 13 Dec 2011 22:33:34 -0800
Apple LLVM 3.0 compiler does not recognize that my methods with "Copy" in their name live by different memory-management rules.
Example…
- mutableDeepCopyStyle:(SSYDeepCopyStyleBitmask)style {
NSMutableSet *newSet = [[NSMutableSet alloc] init];
for (id object in self) {
id copy = [object mutableDeepCopyStyle:style] ;
[newSet addObject:copy];
[copy release]; // LLVM Warning #1
}
return newSet; // LLVM Warning #2
}
LLVM Warnings
#1. Incorrect decrement of the reference count of an object that is not owned at this point by the caller
#2. Potential leak of an object stored into 'newSet'
I think that Warning #1 is spurious because I'm releasing an object which was obtained from a 'Copy' method, which is correct. And Warning #2 is spurious because the method has 'Copy' in its name, therefore returning a retained object is expected.
What is the correct way to fix these warnings?
Thanks,
Jerry Krinock
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden