cocoa memory leak by CGAffineTranform or by view
As instrument tell me, I have a leak in the code. I dont quite get it at all.
my code is like this,
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0,20.0);
[[appDelegate.editController view] setTransform:myTrnsform];
appDelegate.editController.imageView.imag开发者_开发百科e=image;
[[sharedPicker parentViewController] dismissModalViewControllerAnimated:UIModalTransitionStyleCrossDissolve];
[appDelegate.window bringSubviewToFront:appDelegate.editController.view];
[UIView commitAnimations];
[sharedPicker release];
But instrument tell me the line
[[appDelegate.editController view] setTransform:myTrnsform];
is leaking memory.
Could anyone please help me?
I would need more code in order to answer it properly, but the line that makes me smell a memory leak is this one:
appDelegate.editController.imageView.image=image;
I'm not sure where are you getting the variable image
, but when you assign it to the image
property of imageView
it will be retained, and you need to balance that call (either with a release
or an autorelease
at some point).
精彩评论