Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
Extracts from "Memory Management for Android Apps" Taipei GTUG 20110706 Meetup (http://goo.gl/VdfLK) Original Presenter Patrick Dubroy @dubroy Extract Presenter David Wu @wuman blog.wu-man.com
Slide 2
Slide 2 text
2 @wuman David Wu
[email protected]
blog.wu-man.com #tossug, #h4 HTC
Slide 3
Slide 3 text
3 In 10 Minutes...
Slide 4
Slide 4 text
4 Purpose Avoid OOM errors
Slide 5
Slide 5 text
5 Breakdown API Changes Heap size Garbage collection Bitmap allocations Understanding heap usage Memory leaks Logcat Memory Analyzer (MAT)
Slide 6
Slide 6 text
6 Heap Size Heap size limits G1: 16MB Droid: 24MB Nexus One: 32MB Xoom: 48MB ActivityManager.getMemoryClass()
Slide 7
Slide 7 text
7 Large Heaps
Slide 8
Slide 8 text
8 Garbage Collection
Slide 9
Slide 9 text
9 Garbage Collection
Slide 10
Slide 10 text
10 Garbage Collection
Slide 11
Slide 11 text
11 Garbage Collection
Slide 12
Slide 12 text
12 Garbage Collection < Gingerbread Stop-the-world Full heap collection Pause times often > 100ms >= Gingerbread Concurrent (mostly) Partial collections Pause times usually < 5ms
Slide 13
Slide 13 text
13 Bitmaps (Old)
Slide 14
Slide 14 text
14 Bitmaps (New)
Slide 15
Slide 15 text
15 Memory Leaks
Slide 16
Slide 16 text
16 Logcat
Slide 17
Slide 17 text
17 Logcat
Slide 18
Slide 18 text
18 Logcat
Slide 19
Slide 19 text
19 Logcat
Slide 20
Slide 20 text
20 Logcat
Slide 21
Slide 21 text
21 Logcat
Slide 22
Slide 22 text
22 Heap Dumps Create with DDMS andorid.os.Debug.dumpHprofData() Conversion hprof-conv orig.hprof converted.hprof Analyze with MAT
Slide 23
Slide 23 text
23 Shallow and Retained Heap
Slide 24
Slide 24 text
24 Dominator Tree
Slide 25
Slide 25 text
25 Demo Debugging a memory leak with MAT
Slide 26
Slide 26 text
26 Demo
Slide 27
Slide 27 text
27 References Video of the session http://goo.gl/KRrx7 Original slides http://goo.gl/0RqIZ Patrick Dubroy's blog http://dubroy.com/blog/