Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java
Expertise: Advanced
Nov 8, 2017

WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

Reasons for Android Runtime Garbage Collection

In Android Run Time (ART) environment, Garbage Collection activity could be triggered due to one of these reasons:

Concurrent

A concurrent GC that does not suspend app threads. This GC runs in a background thread and does not prevent allocations.

Alloc

The GC was initiated because your app attempted to allocate memory when your heap was already full. In this case, the garbage collection occurred in the allocating thread.

Explicit

The garbage collection was explicitly requested by an app, for example, by calling gc() or gc(). Like Dalvik, in ART, the best practice is that you trust the GC and avoid requesting explicit GCs, if possible. Explicit GCs are discouraged because they block the allocating thread and unnecessarily waste CPU cycles. Explicit GCs could also cause jank (stuttering, juddering, or halting in the app) if they cause other threads to get preempted.

NativeAlloc

The collection was caused by native memory pressure from native allocations such as Bitmaps or RenderScript allocation objects.

CollectorTransition

The collection was caused by a heap transition; this is caused by switching the GC at run time. Collector transitions consist of copying all the objects from a free-list backed space to a bump pointer space (or vice versa). Currently, collector transitions only occur when an app changes process states from a pause perceptible state to a nonpause perceptible state (or vice versa) on low RAM devices.

HomogeneousSpaceCompact

Homogeneous space compaction is free-list space to free-list space compaction which usually occurs when an app is moved to a pause imperceptible process state. The main reasons for doing this are reducing RAM usage and defragmenting the heap.

DisableMovingGc

This is not a real GC reason, but a note that collection was blocked due to use of GetPrimitiveArrayCritical. while concurrent heap compaction is occurring. In general, the use of GetPrimitiveArrayCritical is strongly discouraged due to its restrictions on moving collectors.

HeapTrim

This is not a GC reason, but a note that collection was blocked until a heap trim finished.

Acknowledgement: Android Developer Guide

Ram Lakshmanan
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date