티스토리 뷰



(image from: apple developer site)


In my company, I'm making iOS applications.

And yesterday, I found a very strange memory leak.

I can't show you the real source code in my project.

Therefore I made new test project.

following interface is the hot potato.
 


and this is the test code.



When I analyze this project.
There is no problem.


But !!

The profiler shows me something other OTL .


Can you understand it??
 
I spent several minutes agonizing over this problem.
 
And finally I found the problem.

The problem is "Binding between ivar and property".

When ivar "_a" and property "a" are declared even they are not binded,
compiler and analyzer think like that these variables are already binded.

(ex : @synthesize a = _a;)
 
That is the reason  why there is no warning message from compiler and analyzer.

But at real compile time, compiler can not make any bindings between those, because there is no actual binding. 

Therefore _tmpArray can not be accessed by other interfaces. And there is no code to release property.

To solve this problem, we have to bind these explicitly.

if you want to hide ivar using this example.
 


and if you don't need to hide it, do like this.



.

thanks.

 

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/03   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함