Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Memory Management in iOS App Development
Search
Sumin Byeon
September 03, 2009
Programming
0
110
Memory Management in iOS App Development
Sumin Byeon
September 03, 2009
Tweet
Share
More Decks by Sumin Byeon
See All by Sumin Byeon
Cartography 101
suminb
1
51
Big Data in Action
suminb
1
64
Git with Bitbucket
suminb
0
88
RNA Secondary Structure Prediction
suminb
0
140
Other Decks in Programming
See All in Programming
ISUCON14感想戦で85万点まで頑張ってみた
ponyo877
1
790
traP の部内 ISUCON とそれを支えるポータル / PISCON Portal
ikura_hamu
0
230
ASP. NET CoreにおけるWebAPIの最新情報
tomokusaba
0
220
Amazon Nova Reelの可能性
hideg
0
260
混沌とした例外処理とエラー監視に秩序をもたらす
morihirok
18
3.3k
さいきょうのレイヤードアーキテクチャについて考えてみた
yahiru
1
540
はてなにおけるfujiwara-wareの活用やecspressoのCI/CD構成 / Fujiwara Tech Conference 2025
cohalz
3
3.2k
オニオンアーキテクチャを使って、 Unityと.NETでコードを共有する
soi013
0
390
定理証明プラットフォーム lapisla.net
abap34
1
670
非ブラウザランタイムとWeb標準 / Non-Browser Runtimes and Web Standards
petamoriken
0
450
Vue.jsでiOSアプリを作る方法
hal_spidernight
0
120
ASP.NET Core の OpenAPIサポート
h455h1
0
160
Featured
See All Featured
Practical Orchestrator
shlominoach
186
10k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Site-Speed That Sticks
csswizardry
3
310
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
113
50k
Automating Front-end Workflow
addyosmani
1367
200k
The World Runs on Bad Software
bkeepers
PRO
67
11k
Adopting Sorbet at Scale
ufuk
74
9.2k
Designing for humans not robots
tammielis
250
25k
Being A Developer After 40
akosma
89
590k
Thoughts on Productivity
jonyablonski
68
4.4k
Done Done
chrislema
182
16k
Transcript
Memory Management for iPhone Application Development Sumin Byeon (
[email protected]
)
Advanced Topic
Significance Limited memory (128MB, 256MB) No garbage collection No virtual
memory User experience
Related Functions alloc copy retain release autorelease
Alloc Allocates memory for an object, and returns it with
retain count of 1[1]. Almost equivalent to the new keyword in C+ +, Java, etc. [1] http:/ /developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html
Copy Makes a copy of an object, and return retain
count of 1.
Master Theorem #1 If you allocated it, you should release
it. If you didn’t explicitly allocate it, don’t release it.
Example ! NSString *str = [[NSString alloc] initWithCString:"Boom baby"]; !
NSLog(str); ! [str release];
Example ! NSString *str = [NSString stringWithCString:"Boom baby"]; ! NSLog(str);
Retain Increases the retain count of an object by 1.
Release Decreases the retain count of an object by 1.
Master Theorem #2 If an object is being retained by
something else, you may release it immediately. (e.g. [UIView addSubview:view])
Master Theorem #3 Don’t you dare call dealloc. Always call
release, and dealloc will be called when the retain count becomes zero.
Autorelease
Autorelease with Threads
Instruments Charles Magahern (
[email protected]
)
Questions?