Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Android performance tuning. Memory.

260 views

Published on

Android performance tuning. Memory.

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Android performance tuning. Memory.

  1. 1. ANDROID PERFORMANCE TUNING MEMORY SERGII KOZYREV Senior SE 22.06.2016
  2. 2. Memory
  3. 3. Garbage Collector is such a cool feature
  4. 4. There is always taxes - “performance is not free”? :)
  5. 5. Understanding memory •GC •Find objects that can’t be accessed •Reclaim the resources •Questions: •Heap vs Stack memory? •What GC collects? •How leaks happens?
  6. 6. Concerns
  7. 7. Memory Leaks •It’s not only about OutOfMemoryError •It reduces available memory and causes GC run more frequent - which is bad
  8. 8. Different VMs – different Logs •Dalvik (every GC) •ART (if the GC pause exceeds than 5ms or the GC duration exceeds 100ms) Concurrent VS Alloc
  9. 9. DEMO Memory Monitor
  10. 10. Memory Leaks •Simple - “handler case”, or every circular referenced objects •Complex - holding a handle to the ClassLoader objects, load in onCreate and don’t check if classes already loaded (no class unload procedure)
  11. 11. Memory Leaks •Static Activities, Views, Context aware stuff •Inner Classes •Anonymous Classes •Handlers •Threads and TimerTask •Sensor Manager
  12. 12. DEMO HeapViewver
  13. 13. Move allocations out of inner loops :)
  14. 14. DEMO Allocation Tracker
  15. 15. Thank You!
  16. 16. Links: https://github.com/kozyrevsergey89/PerformanceLab https://github.com/square/leakcanary https://www.udacity.com/course/android-performance--ud825

×