c********g 发帖数: 1173 | |
S**********r 发帖数: 1410 | 2 I suggest you
1. move backgroundImageView.hidden = !selected;
to within
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
because it's not a good idea to manipulate UI in a data member's setter.
2. let system generate setter and getter for you. |
c********g 发帖数: 1173 | 3 I moved the backgroundImageView.hidden = !selected to the touchesBegan: call
. However, now the leaks
instrument reports the touchesBegan is leaking. According to the report, the
leaking statement is
"backgroundImageView.hidden = !selected". That's why I am confused.
I also posted this to Apple's developer forum. One guy mentioned if an
object leaks, all its sub-objects will
leak as well. But I just couldn't find out the root cause.
Thanks anyway.
【在 S**********r 的大作中提到】 : I suggest you : 1. move backgroundImageView.hidden = !selected; : to within : - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event : because it's not a good idea to manipulate UI in a data member's setter. : 2. let system generate setter and getter for you.
|
i*****o 发帖数: 1714 | 4 What happens when background image is shown or hidden, maybe once it is
shown, some view will have a reference to it, and that guy is not releasing
it.
So basically follow the chain reaction caused by this call...
【在 c********g 的大作中提到】 : 最近一个memory leak的问题搞得我头大,有人愿意看看吗?给出有效线索或解决方案 : 的发大包子。 : http://stackoverflow.com/questions/6302545/crazy-leak-detection
|
c*********r 发帖数: 2097 | 5 你的 image 是怎样 init 的 ? 是用
imageWithXXX 这类 helper 还是老老实实的 init? |
S********y 发帖数: 565 | |
r********r 发帖数: 964 | 7 找找可能相关的文件里的alloc,init,new和retain调用,对每一个仔细
验证一下它是怎么release的,也许有帮助。尤其是跟backgroundimageview
有关的那些
【在 S********y 的大作中提到】 : re
|
c********g 发帖数: 1173 | 8 all my images are initialized by "imageNamed"
【在 c*********r 的大作中提到】 : 你的 image 是怎样 init 的 ? 是用 : imageWithXXX 这类 helper 还是老老实实的 init?
|
c*********r 发帖数: 2097 | 9 imageNamed 这种 helper 通常都用 autorelease pool, 不需要你专门去 release.
你换个 initWithContentsOfFile 试试, 别忘了要 explicitly release. 管用的话别
忘了给我包子. |
j*******d 发帖数: 8834 | 10 有memory leak先怀疑所用的lib, 再怀疑compiler,再怀疑OS,再坏疑firmware,再怀疑
hardware
还不行,那只能怀疑上帝了(如果你信的话)
【在 c********g 的大作中提到】 : 最近一个memory leak的问题搞得我头大,有人愿意看看吗?给出有效线索或解决方案 : 的发大包子。 : http://stackoverflow.com/questions/6302545/crazy-leak-detection
|