Reputation: 623
my android application performance is low. from logcat i found that the time consuming factor is garbage collection. it consumes atleast 110ms in every gc. gc is showing frequently. Is there anyway to determine the collected objects??
Upvotes: 0
Views: 4251
Reputation: 52313
In the DDMS tool, go to the "Allocation Tracker" tab. Select your app from the list, and click "Start Tracking". After using the app for a bit, select "Get Allocations".
This will show you the list of the 512 most recent allocations, with sizes and stack traces. From this you should be able to tell what is eating up memory and causing the GCs.
Upvotes: 2
Reputation: 2038
Check out the videos in the http://developer.android.com/videos/index.html
Especially the one talking on "Make your UI faster", there are a lot of design best practices shown in the videos.
It will definitely help your application to run faster.
Upvotes: 1
Reputation: 1235
That's not an odd value for Android GC. The ~100ms and ~500K values are fairly average but that depends on the project specs of course.The real problem is in the frequency that your code causes the GC to be called.
Here's an example: If you implement lists via the ListView
and some custom Adapters
you could get the worst ever performance and the best ever depending on how you write your code for them. If you do not optimize lists and create a new View (by inflating it from the .xml
file) you will get GC calls very often and this is perceived as small hickups or hangups in the UI.
The best method for determining of what causes the GC problem is localizing it. Start your app and use it one part an a time while monitoring the DDMS for GC gumps and then see which element or Activity causes most of them and go from there.
Also try memory usage monitoring with some tools. For instance if you are using Eclipse there is a tool called MAT that will give you a bit more insight into object usage throughout your project.
Upvotes: 1