cocoa 内存泄漏由 CGAffineTranform 或视图
正如仪器告诉我的那样,我的代码存在泄漏。 我完全不明白。
我的代码是这样的,
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0,20.0);
[[appDelegate.editController view] setTransform:myTrnsform];
appDelegate.editController.imageView.image=image;
[[sharedPicker parentViewController] dismissModalViewControllerAnimated:UIModalTransitionStyleCrossDissolve];
[appDelegate.window bringSubviewToFront:appDelegate.editController.view];
[UIView commitAnimations];
[sharedPicker release];
但是仪器告诉我行
[[appDelegate.editController view] setTransform:myTrnsform];
正在泄漏内存。
有人可以帮我吗?
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.image=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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我需要更多代码才能正确回答它,但是让我闻到内存泄漏的那一行是这样的:
我不确定你从哪里获得变量
image
,但是当你分配时它会被保留到imageView
的image
属性,并且您需要平衡该调用(使用release
或自动释放
在某个时刻)。I would need more code in order to answer it properly, but the line that makes me smell a memory leak is this one:
I'm not sure where are you getting the variable
image
, but when you assign it to theimage
property ofimageView
it will be retained, and you need to balance that call (either with arelease
or anautorelease
at some point).