Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android GC - LogCat always showing GC activity

when i run my program, logcat shows a lot of activity with GC

like

GC freed 10324 objects/ 510376 bytes in 103 ms
GC freed 10324 objects/ 510376 bytes in 103 ms
GC freed 10324 objects/ 510376 bytes in 103 ms
GC freed 10324 objects/ 510376 bytes in 103 ms
GC freed 10324 objects/ 510376 bytes in 103 ms

with diff in obj, bytes and ms values...

is it because of some bad practice of coding ?

like image 798
Sumit M Asok Avatar asked Feb 16 '10 14:02

Sumit M Asok


Video Answer


2 Answers

Use the standalone DDMS program and its Allocation Tracker tab to check where/what is being allocated. The DDMS program ships with the sdk. (This is not the same as the ddms tab in Eclipse.)

like image 147
Al. Avatar answered Sep 22 '22 17:09

Al.


If your program dont necessarily needs to dispose of that many objects, then yes. Otherwise, no. If your program needs to run faster or is for example a game that needs to run smooth at all times, then you might try re-using objects to a greater extent.

like image 30
pgsandstrom Avatar answered Sep 24 '22 17:09

pgsandstrom