DZone
Mobile Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Mobile Zone > Android Dalvik GC Log Analysis

Android Dalvik GC Log Analysis

Your mobile app's memory usage impacts the user experience. Gain a better understanding of how memory usage is logged and what it can tell you.

Ram Lakshmanan user avatar by
Ram Lakshmanan
CORE ·
May. 19, 17 · Mobile Zone · Opinion
Like (1)
Save
Tweet
3.23K Views

Join the DZone community and get the full member experience.

Join For Free

Memory utilization on a mobile app has a significant impact on the customer experience. If your app creates a lot of objects, then the Garbage Collection (GC) process will be triggered frequently to evict unused objects. Even though Garbage Collection is an automatic process, however, frequent Garbage Collection consumes a lot of CPU, and it will also pause the app. Frequent pauses can mess up the app (e.g. stuttering or halting).

Thus, you need to understand how many objects your app is creating, how frequently Garbage Collection is triggered, how much time it takes to complete, and how much memory is reclaimed after every event. All this information is present in the runtime log messages. Whenever a GC event runs, a log line is printed in the runtime log messages. You can view those log lines through logcat.

GC log line format varies based on whether app runs on Dalvik VM or Android Run Time (ART). In an earlier article, we saw how to analyze ART GC log lines. Now let’s see how to analyze a Dalvik GC log line.

This is how a typical Dalvik GC log line will look:

Image title

This one single log line has multiple fields. Below table summarizes each field in detail:

 

#

Field Value Description
1 Timestamp 07-01 15:56:19.815 Timestamp at which this Garbage Collection event ran
2 GC Reason GC CONCURRENT Reason why Garbage Collection event was triggered. Please refer here for different types of GC Reasons.
3 Objects freed 7078K Amount of objects garbage collected. Totally 7078kb of objects are garbage collected (i.e. freed) in this event.
4 Heap usage 52464K/ 89052K 52464kb of objects are alive after this particular GC event. Total allocated heap size for this app is 89052 kb.
5 GC Pause Time 14ms+4ms During certain phases of GC event, application is paused. In this GC event, pause time is 18 ms (i.e. 14 + 4 ms). During pause time, application freezes. One should target for low pause time.
6 GC Total Time 96ms Amount of time this GC event took to complete. It includes the GC Pause time as well.

Tools

As it might get tedious to analyze every single GC log line, you can also consider using free online tools such as GCeasy.io – a universal Garbage collection log analyzer, to analyze Android GC logs. You can just upload the Android GC Logs to this tool. Tool parses GC log and generates report instantly. Report contains interactive graphs and insightful metrics. A few excerpts from this report are given below for your reference.

Image title

Fig 1: Android memory usage – report generated by GCeasy.io.

Image title

Fig 2: KPI – report generated by GCeasy.io.

garbage collection Android (robot) Dalvik (software) Log analysis mobile app Garbage (computer science) Event

Published at DZone with permission of Ram Lakshmanan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • A Brief History of the DMCA
  • Refactor Switch to a One-Liner
  • Architecture as Code With C4 and Plantuml
  • 5 Best JavaScript Web Development Frameworks

Comments

Mobile Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo