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
130
Other Decks in Programming
See All in Programming
テストケースの名前はどうつけるべきか?
orgachem
PRO
0
130
たのしいparse.y
ydah
3
120
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
似たもの同士のPerlとPHP
uzulla
1
130
선언형 UI에서의 상태관리
l2hyunwoo
0
130
Semantic Kernelのネイティブプラグインで知識拡張をしてみる
tomokusaba
0
180
KubeCon + CloudNativeCon NA 2024 Overviewat Kubernetes Meetup Tokyo #68 / amsy810_k8sjp68
masayaaoyama
0
240
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
17年周年のWebアプリケーションにTanStack Queryを導入する / Implementing TanStack Query in a 17th Anniversary Web Application
saitolume
0
250
KMP와 kotlinx.rpc로 서버와 클라이언트 동기화
kwakeuijin
0
130
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Visualization
eitanlees
146
15k
Optimising Largest Contentful Paint
csswizardry
33
3k
4 Signs Your Business is Dying
shpigford
181
21k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
0
94
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
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?