Question

I have android application 2.3.3 use calendarView when press button => show dialog (contain calendarView)

My logcat display:

D/dalvikvm(15292): GC_CONCURRENT freed 1988K, 10% free 20024K/22087K, paused 4ms+3ms
D/dalvikvm(15292): GC_CONCURRENT freed 1995K, 10% free 20022K/22087K, paused 4ms+3ms
D/dalvikvm(15292): GC_CONCURRENT freed 1986K, 10% free 20029K/22087K, paused 4ms+3ms
D/dalvikvm(15292): GC_CONCURRENT freed 2005K, 10% free 20023K/22087K, paused 4ms+3ms
D/dalvikvm(15292): GC_CONCURRENT freed 1995K, 10% free 20016K/22087K, paused 4ms+3ms
D/dalvikvm(15292): GC_CONCURRENT freed 1997K, 10% free 20022K/22087K, paused 3ms+4ms

It slows down my app... I think Garbage collection paused my app Please help me show it quickly!

Thanks!

Was it helpful?

Solution

Garbage Collector is a daemon thread. You can neither stop it nor call it. You can just make a request, eg.- System.gc(), to the garbage collector.

Plus, garbage collector helps improving the performance.

If you do not want to get your objects getting collected by GC then just Hold the reference.

If your object is getting collected prematurely, it is a symptom that you have a bug in the design of your application.

OTHER TIPS

When implementing applications (like games etc) that need to avoid garbage collection because of the small pauses it introduces every time the garbage collector executes,

All you can do is avoid to keep on creating objects and try to reuse as much as possible the objects instances you already have.

This can be done in different ways take a look at this

When using CalendarView I noticed one quite surprising thing. When I set calendar heigh as number, ex. android:layout_height="400dp" garbage collector is not run, however when I set it as match_parent garbage collector is run every time I switch orientation. Perhaps that's the answer?

i resolved my problem. because my dialog have RelativeLayout to contain calendarView. i changed RelativeLayout to LinearLayout => Garbage collection not start

Thanks!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top