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
99
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
47
Big Data in Action
suminb
1
59
Git with Bitbucket
suminb
0
78
RNA Secondary Structure Prediction
suminb
0
120
Other Decks in Programming
See All in Programming
冗長なエラーログを削減し、スタックトレースを手に入れる / Reducing Verbose Error Logs and Obtaining Stack Traces
upamune
0
230
if constexpr文はテンプレート世界のラムダ式である
faithandbrave
3
630
単体テストを書かない技術 #phpcon_odawara
o0h
PRO
26
8.2k
Compose-View Interop in Practice (mDevCamp 2024)
stewemetal
0
110
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
820
TYPO3 v13 – The road to LTS: What's new and new APIs
luisasofie_xoxo
0
190
今、知っておきたい! 生成AIエージェントの世界
elith
3
350
Build Apps for iOS, Android & Desktop in 100% Kotlin With Compose Multiplatform (mDevCamp 2024)
zsmb
0
220
Random\Randomizer クラスで日常のあれこれを解決しよう! / Random\Randomizer class solves familiar trouble
cocoeyes02
0
140
Rails と人魚の話/rails-and-mermaid
sanfrecce_osaka
0
100
Elm Form Validation
bkuhlmann
0
510
Amazon SQSコンシューマー疎結合への旅 - 出張! #DevelopersIO IT技術ブログの中の人が語る勉強会 #3
quiver
0
220
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
77
42k
Optimising Largest Contentful Paint
csswizardry
7
2.3k
Faster Mobile Websites
deanohume
298
30k
Embracing the Ebb and Flow
colly
79
4.1k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
51k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Intergalactic Javascript Robots from Outer Space
tanoku
266
26k
Statistics for Hackers
jakevdp
789
220k
GraphQLの誤解/rethinking-graphql
sonatard
50
9.2k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
16
1.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
13
1.5k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
30
6k
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?