Why does it always shows GC_CONCURRENT FREED and GC_CONCURRENT ALLOCATE in Android Logcat while running a app?
Asked Answered
E

3

11

I would like to know that why does the below message shows up everytime while running any application.

12-11 17:18:37.141: D/dalvikvm(3155): GC_CONCURRENT freed 485K, 9% free 6696K/7303K, paused 9ms+335ms

paused 9ms+335ms due to this pause my audio which i supposed to play is missing, because as per my code it receives audio data every 40ms so here it paused for 9ms+335ms which is 10 times data loss

I know its performing some kind of Garbage Collection but my question is why does it frequently comes in the logcat.

Thanks for any kind of help!!!!!!

Electrotechnology answered 11/12, 2012 at 11:54 Comment(5)
what kind of task r u performing?Forlorn
i m performing audio record and playElectrotechnology
These are system logs to show memory info of application.Lenzi
don't worry ... it's nothing unusualPedicab
@ALL, I have edited my question, please look at that and give me a solutionElectrotechnology
E
15

Garbage Collection is used by Java to prevent you from going Out of memory by removing Objects that are no longer referenced by any class and cannot be reached from your code.

If you have too many of these objects, you will get GC calls alot, which may at some times affect your performance. On the other hand, having Objects that are referenced all the time, may prevent GC from being called (memory leak) and your memory may fill up and you get an OutOfMemoryException.

Your goal is not to eliminate GC, but reduce them as much as possible in methods that are delay sensitive and are running on the UI thread (like onDraw(), getView(), ... for e.g.).

Eppes answered 11/12, 2012 at 12:37 Comment(2)
I have edited my question, please look at that and give me a solutionElectrotechnology
You still need to minimize object definition to minimize GC. You need to show us the code that plays the audio to assist you in finding these objects.Eppes
L
4

That is normal behaviour for Android. The phone just does garbage collection. For more information checkout the great Google I/O video on this: Google I/O 2011: Memory management for Android Apps

Lilianaliliane answered 11/12, 2012 at 13:28 Comment(2)
I have edited my question, please look at that and give me a solutionElectrotechnology
You really need to check for optimizations to your code. Sounds like your code requires too much GC's.Lilianaliliane

© 2022 - 2024 — McMap. All rights reserved.