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
120
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
65
Git with Bitbucket
suminb
0
89
RNA Secondary Structure Prediction
suminb
0
140
Other Decks in Programming
See All in Programming
ニーリーにおけるプロダクトエンジニア
nealle
0
620
Create a website using Spatial Web
akkeylab
0
310
ruby.wasmで多人数リアルタイム通信ゲームを作ろう
lnit
2
290
Beyond Portability: Live Migration for Evolving WebAssembly Workloads
chikuwait
0
400
Is Xcode slowly dying out in 2025?
uetyo
1
210
Composerが「依存解決」のためにどんな工夫をしているか #phpcon
o0h
PRO
1
240
ReadMoreTextView
fornewid
1
490
アンドパッドの Go 勉強会「 gopher 会」とその内容の紹介
andpad
0
270
Team operations that are not burdened by SRE
kazatohiei
1
270
WebViewの現在地 - SwiftUI時代のWebKit - / The Current State Of WebView
marcy731
0
100
Goで作る、開発・CI環境
sin392
0
150
システム成長を止めない!本番無停止テーブル移行の全貌
sakawe_ee
1
150
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
48
5.4k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.7k
Speed Design
sergeychernyshev
32
1k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Designing Experiences People Love
moore
142
24k
Docker and Python
trallard
44
3.4k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
181
53k
BBQ
matthewcrist
89
9.7k
Facilitating Awesome Meetings
lara
54
6.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.4k
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?