I'm using an NSObject derived model to track data about an individual person in a facial recognition app.
The flow of my app is depicted below. After the model is created, each method performs some image processing and assigns the result to the model that was passed in. Then passes the model back out.
CVPersonModel * newPerson = [[CVPersonModel alloc] initWithImage:img];
newPerson = [self.faceProcessor processFaceFromImage:preProcessedImg withModel:newPerson];
newPerson = [self.eyeProcessor processEyesFromImage:processFaceFromImage:preProcessedImg withModel:newPerson];
newPerson = [self.lipsProcessor processLipsFromImage:preProcessedImg withModel:newPerson];
The problem is i'm running into some memory leaks related to this model, and I wonder if part of it may be re-assigning it multiple times across multiple threads?
Would it be better (and is it possible) to mutate the object in place?
The calls above would be the same, except each method returns void. Because the model is actually a pointer, newPerson in the calling method should reflect all changes made within each subsidiary method right?
Aucun commentaire:
Enregistrer un commentaire