Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Memory Leak on Andriod - GDG LA July 2016
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Aaron He
July 28, 2016
Technology
53
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Memory Leak on Andriod - GDG LA July 2016
Aaron He
July 28, 2016
Transcript
16 slides
Memory Leak on Android Aaron He
Out of memory error Fatal Exception: java.lang.OutOfMemoryError Fail to allocate
a x byte allocation with y free bytes until OOM
Heap
Causes of OOM • View pager inception • Bitmaps •
Library designed for Java not Android • Or…
Memory leak
Wait a sec…
Not if you are like this cat
How memory leaks • The reference to the root outlives
the root’s lifecycle. Activity/Context leak Listeners Be aware of anonymous class Android framework
Tools to help • Eclipse Memory Analyzer • LeakCanary •
Android Studio Memory Monitor
Eclipse Memory Analyzer • Dump HPROF in DDMS • Convert
it to J2SE format • Start analyzing! OQL
LeakCanary • HAHA(Headless Android Heap Analyzer): https:// github.com/square/haha • LeakCanary:
https://github.com/square/leakcanary • Customization
Demo!
Memory Monitor in AS Initiate GC Dump Heap Allocation tracker
Memory usage
Demo!
References • Managing Your App’s Memory: https://developer.android.com/training/ articles/memory.html • Managing
Bitmap Memory: https://developer.android.com/training/ displaying-bitmaps/manage-memory.html • Joda Time’s Memory Issue in Android: http://blog.danlew.net/2013/08/20/ joda_time_s_memory_issue_in_android/ • Eclipse Memory Analyzer: http://www.eclipse.org/mat/ • Detect all memory leaks with LeakCanary: https://youtu.be/mU1VcKx8Wzw • Android Studio Memory Monitor: https://developer.android.com/studio/ profile/am-memory.html
Thank you!
[email protected]
@aaronhe42
More Decks by Aaron He
See All by Aaron He
Road to Modularization(DroidCon NYC 2019)
aaronhe
1
230
There's No Magic - How Kotlin can be your best friends @DevFest LA 2017
aaronhe
0
51
Google I/O '17 recap - GDG LA May 2017 Android@Tinder
aaronhe
0
110
RxJava for Android - GDG DevFest LA 2016
aaronhe
0
96
Auto Value and Its Extension GDG LA April
aaronhe
0
66
OkMVP
aaronhe
0
83
Other Decks in Technology
See All in Technology
Kiro IDE 入門 (画面の各部から、頼み方、任せ方、戻し方まで) | 目指せ Kiro マスター 02
inariku
PRO
4
250
SSFの現在地 ― CAEP/RISCからAI Identityへ
oidfj
0
440
IP重複は"ランディングVPC"で受け止める ― PrivateLink と Transit Gatewayによるマルチテナント接続基盤の設計
hatahata021
2
170
マネージャーをエスパーにしない マネジメントされる側から始める、働きやすい現場づくり
comi190327
0
510
AWS Quick 入門 | 目指せ Quick マスター 01
inariku
PRO
2
350
20261113_JAWS_Osaka
takuyay0ne
0
500
大江戸Ruby会議でデータベース クライアントの話をするのは 間違っているだろうか
yahonda
1
130
Where Should Platform Complexity Live? Lessons from a Cross-Team PR Preview Platform
taiki45
0
110
LLM 基盤と kagent v0 を全部 k8s に入れてみた / Deploy both LLM and kagent v0 in k8s
kota2and3kan
0
220
AWS Emulator を評価する: 手元で動く AWS の API の仕組み、始め方、確かめ方
inariku
PRO
1
640
高品質と高スピードを支える品質のシフトレフトのアプローチ
goyoki
4
1.3k
あの日、見つかっていなかったらどうなっていたか
kazzpapa3
2
220
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
590
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
560
BBQ
matthewcrist
90
10k
Amusing Abliteration
ianozsvald
1
390
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
330
Game over? The fight for quality and originality in the time of robots
wayneb77
1
330
SEO for Brand Visibility & Recognition
aleyda
0
4.9k
Believing is Seeing
oripsolob
1
280
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
560
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k