(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;)
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.
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.
'programming' 카테고리의 다른 글
| iOS Development : ivar and property declaration and binding (iOS 개발 ivar와 property 선언 그리고 binding) (0) | 2012/01/20 |
|---|---|
| Apple은 알고 있지만, 나는 모르는 점. (1) | 2009/12/07 |
| Windows Mobile Today Plugin 만들기. (0) | 2009/08/10 |
| Fliking을 자연스럽게 구현 하려면?? (0) | 2009/08/10 |
| 시계를 그리는 알고리즘은 어떻게 짜는게 좋은가?? (0) | 2009/08/05 |
| "Write in C!!" (0) | 2009/04/28 |