Test de mon application sur l'appareil, il retourne une fuite lorsque j'appelle la copie d'un objet personnalisé et je ne comprends pas pourquoi.IPhone - copyWithZone fuite
c'est l'appel:
NSMutableArray *arr = [[NSMutableArray alloc] initWithCapacity:5];
for (SinglePart *sp in [copyFrom partList]) {
[arr addObject:[sp copy]];
}
self.partList = arr;
[arr release];
c'est la méthode:
- (id)copyWithZone:(NSZone *)zone {
SinglePart *copy = [[[self class] allocWithZone:zone] initWithSinglePart:self];
[copy loadImage];
return copy;
}
c'est la méthode qui est appelée par copyWithZone:
- (id)initWithSinglePart:(SinglePart *)copyFrom {
if (self = [super init]) {
self.imagePath = [copyFrom.imagePath copy];
self.color = [UIColor colorWithCGColor:copyFrom.color.CGColor];
self.hasOwnColor = copyFrom.hasOwnColor;
self.blendingMode = copyFrom.blendingMode;
}
return self;
}
Merci beaucoup ... j'ai vraiment besoin de lire un peu plus sur la gestion de la mémoire. Pouvez-vous suggérer un lien? :) – w4nderlust
http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html –