티스토리 뷰
programming
iOS Development : ivar and property declaration and binding (iOS 개발 ivar와 property 선언 그리고 binding)
gunnih 2012. 1. 21. 02:03
(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' 카테고리의 다른 글
Git Log : print merge tree (0) | 2013.11.10 |
---|---|
[It's not But!! update 2013.08.09] KIWI (BDD/TDD Framework) seems like to have a bug (3) | 2013.05.23 |
Apple은 알고 있지만, 나는 모르는 점. (1) | 2009.12.08 |
Windows Mobile Today Plugin 만들기. (0) | 2009.08.10 |
Fliking을 자연스럽게 구현 하려면?? (0) | 2009.08.10 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 김봉두
- Programing
- IFA 2011
- 독일
- 호핑투어
- CocoaPods
- 교육
- 독일 이민
- 세부
- widget
- 필리핀
- UbiVelox
- ios
- 독일이민
- idle
- Blue Card
- 블루카드
- mobile
- 독일 구직
- windows mobile
- demo application
- It
- mixnstand
- IFA
- 독일 IT
- 학교
- 커피
- 사무실
- 교사
- 호핑
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함