8
Memory profiling Ivan Kocijan

Infinum Android Talks #13 - Memory profiling

  • Upload
    infinum

  • View
    35

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Infinum Android Talks #13 - Memory profiling

Memory profilingIvan Kocijan

Page 2: Infinum Android Talks #13 - Memory profiling

If you are an Android developer you probably hate this error:

java.lang.OutOfMemoryError

This error occurs due to various reasons but luckily there are tools for detecting and reducing memory leaks.

Page 3: Infinum Android Talks #13 - Memory profiling

1. DDMS 2. Memory Analyzer (MAT) - http://www.eclipse.org/

mat/

TOOLS

Page 4: Infinum Android Talks #13 - Memory profiling

DDMS

Page 5: Infinum Android Talks #13 - Memory profiling

MAT

• MAT analyzes java heap dumps • DDMS creates an Android heap dump • To convert Android heap dump to Java we can use a tool called hprof. It comes with Android SDK and it’s used like this:

hprof-conv android.hprof java.hprof

Page 6: Infinum Android Talks #13 - Memory profiling
Page 7: Infinum Android Talks #13 - Memory profiling

With DDMS and MAT we can easily detect and stop memory leaks. By reducing memory leaks we can make our application work a lot better and faster but think before you do this. It takes time and at the end you might not get the desired result.

Page 8: Infinum Android Talks #13 - Memory profiling

References:

• http://www.eclipse.org/mat/ • http://developer.android.com/tools/debugging/ddms.html