I see a lot of this:
06-19 17:29:11.911: DEBUG/dalvikvm(10028): GC_FOR_MALLOC freed 729K, 54% free 3490K/7431K, external 0K/512K, paused 39ms
06-19 17:29:11.941: DEBUG/dalvikvm(10028): GC_FOR_MALLOC freed <1K, 49% free 3855K/7431K, external 0K/512K, paused 29ms
repeatedly in the log. Is there a way to not show the Dalvik debug messages?
Simply set a logcat filter. You can do this graphically in Eclipse as well.
Related
I'm getting some non fatal errors on my logcat but no line numbers or anything else that can help me locate the error.
As you can see, I'm getting several, including Cursor finalized without prior close() and Window is full, but no idea how to find them.
09-26 14:20:47.743: W/CursorWindow(2090): Window is full: requested allocation 756 bytes, free space 150 bytes, window size 2097152 bytes
09-26 14:20:48.151: D/dalvikvm(2090): GC_FOR_ALLOC freed 1686K, 3% free 90204K/92076K, paused 108ms, total 112ms
09-26 14:20:48.159: W/CursorWrapperInner(2090): Cursor finalized without prior close()
09-26 14:20:48.163: W/CursorWrapperInner(2090): Cursor finalized without prior close()
09-26 14:20:49.759: D/dalvikvm(2090): GC_FOR_ALLOC freed 910K, 2% free 91343K/92436K, paused 115ms, total 115ms
09-26 14:20:51.127: D/dalvikvm(2090): GC_FOR_ALLOC freed 731K, 1% free 92661K/93576K, paused 70ms, total 70ms
09-26 14:20:52.195: D/dalvikvm(2090): GC_FOR_ALLOC freed 683K, 1% free 94024K/94892K, paused 71ms, total 71ms
09-26 14:20:53.303: D/dalvikvm(2090): GC_FOR_ALLOC freed 713K, 1% free 95360K/96256K, paused 77ms, total 77ms
09-26 14:20:54.403: D/dalvikvm(2090): GC_FOR_ALLOC freed 706K, 1% free 96702K/97592K, paused 84ms, total 84ms
09-26 14:20:54.755: W/CursorWindow(2090): Window is full: requested allocation 756 bytes, free space 645 bytes, window size 2097152 bytes
09-26 14:20:55.559: D/dalvikvm(2090): GC_FOR_ALLOC freed 752K, 1% free 98000K/98936K, paused 76ms, total 76ms
Any tips?
Thanks!
This kind of errors are not exceptions thrown by the program and will therefore not contain a stack-trace. As a general rule of thumb you may find ways to optimize your code by carefully reading the error message and read into the subject concerning the error.
As far as I can see it is a problem with allocation of memory. I don't think you can pinpoint them to a specific position in your execution flow since it will probably occur at different points in execution. You can think about your code to see if you can find some memory optimization possibilities.
If you want to analyze your code thoroughly you may want to use a tool like 'Eclipse MAT'. Read this tutorial to learn how to use the tool
Do a global file search looking for text like ".query(" in your .java files.
That should lead you to places where a Cursor is returned and from there you should be able to determine where they are not being closed.
I am working with Google Maps v2 for Android.
I need to display some View over the map's marker, so I am updating its position every 16ms to keep 60fps.
And I got a problem with that code:
Point targetPosition = getMap().getProjection()
.toScreenLocation(mTrackingMarkerPos);
Because it seems that it causes explicitly calls to the System.gc() or Runtime.getRuntime().gc().
So I got this in log output:
03-12 15:00:24.362 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 122K, 10% free 12710K/14116K, paused 11ms+11ms, total 115ms
03-12 15:00:25.583 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 123K, 10% free 12711K/14116K, paused 7ms+4ms, total 100ms
03-12 15:00:26.845 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 123K, 10% free 12711K/14116K, paused 11ms+6ms, total 104ms
03-12 15:00:28.056 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 217K, 10% free 12710K/14116K, paused 11ms+5ms, total 98ms
03-12 15:00:29.287 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 121K, 10% free 12712K/14116K, paused 11ms+7ms, total 112ms
03-12 15:00:30.499 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 123K, 10% free 12712K/14116K, paused 7ms+4ms, total 87ms
03-12 15:00:31.760 19135-19135/my_fake_package_name D/dalvikvm﹕ GC_EXPLICIT freed 126K, 10% free 12711K/14116K, paused 7ms+4ms, total 130ms
As you can see, GC_EXPLICIT can pause my app for about 100ms!
So my approach to keep 60fps is not achievable because of Google Maps v2 :(
If I comment that line, GC_EXPLICIT calls will disappear. I think that problem in Google Maps v2, I checked their .class files but I did not find any calls to System.gc, so may be I am wrong...
If you know how to find call to the System.gc() I will be glad to know it too, or guys from Google can help me with this issue?
P.S. Asked this on gmaps-api-issues: https://code.google.com/p/gmaps-api-issues/issues/detail?id=6483&thanks=6483&ts=1394624273
in my simple app i am using 6 buttons and setting background with png.
Button btnGadgetmusic = (Button) findViewById(R.id.gadgetmusic);
btnGadgetmusic.setBackgroundResource(R.drawable.btnselectedsong);
minimum size of png is 13.5K and maximum size is 40K. When ever i try to run this app on emulator with version 2.3, i get "external allocation too large for this process" and interestningly if i run on honeycomb or on ICS then there is no problem.
So i am confused what should i do, should i ignore it, if not, do we have some better solution for that.
looking for your reply
EDIT Log File added
I/dalvikvm-heap(4190): Clamp target GC heap from 25.494MB to 24.000MB
D/dalvikvm(4190): GC_FOR_MALLOC freed <1K, 51% free 2647K/5379K, external 18806K/20812K, paused 28ms
D/dalvikvm(4190): GC_EXTERNAL_ALLOC freed <1K, 51% free 2647K/5379K, external 18806K/20812K, paused 49ms
I/dalvikvm-heap(4190): Clamp target GC heap from 25.833MB to 24.000MB
D/dalvikvm(4190): GC_FOR_MALLOC freed 0K, 51% free 2647K/5379K, external 19153K/20812K, paused 25ms
D/dalvikvm(4190): GC_EXTERNAL_ALLOC freed <1K, 51% free 2657K/5379K, external 19153K/20812K, paused 56ms
I/dalvikvm-heap(4190): Clamp target GC heap from 25.852MB to 24.000MB
D/dalvikvm(4190): GC_FOR_MALLOC freed <1K, 51% free 2657K/5379K, external 19162K/20812K, paused 24ms
D/dalvikvm(4190): GC_EXTERNAL_ALLOC freed 4K, 51% free 2671K/5379K, external 19162K/20812K, paused 69ms
I/dalvikvm-heap(4190): Clamp target GC heap from 25.887MB to 24.000MB
D/dalvikvm(4190): GC_FOR_MALLOC freed 0K, 51% free 2671K/5379K, external 19184K/20812K, paused 28ms
W/KeyCharacterMap(4190): No keyboard for id 0
W/KeyCharacterMap(4190): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
W/KeyCharacterMap(4190): No keyboard for id 0
W/KeyCharacterMap(4190): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
I/dalvikvm-heap(4190): Clamp target GC heap from 25.913MB to 24.000MB
D/dalvikvm(4190): GC_CONCURRENT freed 16K, 50% free 2697K/5379K, external 19184K/20812K, paused
3ms+35ms
I/dalvikvm-heap(4190): Clamp target GC heap from 25.942MB to 24.000MB
D/dalvikvm(4190): GC_CONCURRENT freed 13K, 50% free 2727K/5379K, external 19184K/20812K, paused 3ms+3ms
D/dalvikvm(4190): GC_EXTERNAL_ALLOC freed 2K, 50% free 2724K/5379K, external 19184K/20812K, paused 65ms
E/dalvikvm-heap(4190): 20736-byte external allocation too large for this process.
I/dalvikvm-heap(4190): Clamp target GC heap from 25.939MB to 24.000MB
E/GraphicsJNI(4190): VM won't let us allocate 20736 bytes
D/dalvikvm(4190): GC_FOR_MALLOC freed 0K, 50% free 2724K/5379K, external 19184K/20812K, paused 38ms
D/skia(4190): --- decoder->decode returned false
D/AndroidRuntime(4190): Shutting down VM
W/dalvikvm(4190): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime(4190): FATAL EXCEPTION: main
E/AndroidRuntime(4190): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
I am trying to setup a android virtual device to test syncing with an activesync-server.
I followed these steps:
The problem is that syncing is not working at all, but there are no errors like connection errors ...
IMO the problem is that the virtual device only has a private IP, so the server never can send anything to it?
So I probably need some kind of forwarding, like here:
But I am not sure if that’s correct and I am also not sure which ports should be forwarded.
Here is the logcat, when I want to sync:
W/InputMethodManagerService( 148): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#41302038 attribute=null
I/Choreographer( 274): Skipped 41 frames! The application may be doing too much work on its main thread.
D/dalvikvm( 477): GC_CONCURRENT freed 396K, 6% free 8392K/8903K, paused 15ms+7ms, total 527ms
D/dalvikvm( 274): GC_CONCURRENT freed 360K, 11% free 9493K/10567K, paused 29ms+48ms, total 142ms
I/EAS ContactsSyncAdapterService( 477): Contact sync requested for test#example.com
D/dalvikvm( 148): GREF has increased to 601
D/dalvikvm( 477): WAIT_FOR_CONCURRENT_GC blocked 0ms
I/Choreographer( 274): Skipped 33 frames! The application may be doing too much work on its main thread.
D/dalvikvm( 477): GC_EXPLICIT freed 333K, 7% free 8355K/8903K, paused 78ms+32ms, total 1269ms
I/EAS EmailSyncAdapterService( 477): performSync
I/EAS EmailSyncAdapterService( 477): Mail sync requested for test#example.com
D/dalvikvm( 460): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 460): GC_EXPLICIT freed 216K, 5% free 8483K/8839K, paused 145ms+94ms, total 914ms
D/dalvikvm( 148): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 148): GC_EXPLICIT freed 510K, 7% free 11338K/12167K, paused 8ms+35ms, total 323ms
D/dalvikvm( 274): GC_CONCURRENT freed 415K, 11% free 9486K/10567K, paused 25ms+28ms, total 125ms
E/Inbox[test#example.com]( 477): Uncaught exception in EasSyncServicejava.lang.ArrayIndexOutOfBoundsException: length=32; index=32
E/Inbox[test#example.com]( 477): Sync ended due to an exception.
D/dalvikvm( 477): GC_CONCURRENT freed 376K, 6% free 8420K/8903K, paused 5ms+18ms, total 66ms
I don't think this is a problem with your networking setup. It looks like you have an error in your Sync code, that is causing the process to stop:
E/Inboxtest#example.com: Uncaught exception in EasSyncServicejava.lang.ArrayIndexOutOfBoundsException: length=32; index=32
E/Inboxtest#example.com: Sync ended due to an exception.
>
Wrap this code in a try/catch block to understand what is happening better.
I'm getting a flood of GC_CONCURRENT freed messages in LogCat and they are not coming from my own app (I force closed my app to be sure). The memory freed is very consistent (about 1430K) and it occurs about 6 times per second.
How can I troubleshoot this?
It's interfering with my app development because it floods LogCat and forces valuable log statements out of the buffer and also causes LogCat to "jiggle" because the session filter jumps up and down one line each time a GC_CONCURRENT event occurs.
The phone is a Motorola Atrix 2 running Android 2.3.5. I use the phone for development only so it has almost no additional apps than the stock bloatware from AT&T.
11-14 10:50:14.117: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4712K/9671K, external 2357K/2773K, paused 3ms+3ms
11-14 10:50:14.273: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:14.429: D/dalvikvm(724): GC_CONCURRENT freed 1431K, 52% free 4712K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:14.585: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:14.742: D/dalvikvm(724): GC_CONCURRENT freed 1428K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:14.898: D/dalvikvm(724): GC_CONCURRENT freed 1430K, 52% free 4713K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:15.054: D/dalvikvm(724): GC_CONCURRENT freed 1427K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:15.210: D/dalvikvm(724): GC_CONCURRENT freed 1432K, 52% free 4711K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:15.367: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4712K/9671K, external 2357K/2773K, paused 3ms+2ms
11-14 10:50:15.523: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:15.679: D/dalvikvm(724): GC_CONCURRENT freed 1432K, 52% free 4711K/9671K, external 2357K/2773K, paused 3ms+3ms
11-14 10:50:15.835: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4712K/9671K, external 2357K/2773K, paused 3ms+2ms
11-14 10:50:15.992: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+2ms
11-14 10:50:16.148: D/dalvikvm(724): GC_CONCURRENT freed 1429K, 52% free 4713K/9671K, external 2357K/2773K, paused 3ms+3ms
11-14 10:50:16.304: D/dalvikvm(724): GC_CONCURRENT freed 1429K, 52% free 4712K/9671K, external 2357K/2773K, paused 3ms+3ms
11-14 10:50:16.460: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4714K/9671K, external 2357K/2773K, paused 2ms+3ms
11-14 10:50:16.617: D/dalvikvm(724): GC_CONCURRENT freed 1430K, 52% free 4713K/9671K, external 2357K/2773K, paused 3ms+3ms
11-14 10:50:16.773: D/dalvikvm(724): GC_CONCURRENT freed 1429K, 52% free 4712K/9671K, external 2357K/2773K, paused 3ms+3ms
11-14 10:50:16.929: D/dalvikvm(724): GC_CONCURRENT freed 1426K, 52% free 4714K/9671K, external 2357K/2773K, paused 3ms+3ms
The process ID is shown in the message (in the above, it's pid 724). You can use adb shell ps to get the Linux process dump; find the entry for pid 724 to see which app it is.
Alternatively, if you're on a developer device, within Eclipse/ADT/DDMS you can open the "Devices" view and see all processes. Select the app with the matching pid (second column), then open the "Threads" view. This shows all the threads in the app. Look for a thread with high values in the "utime" and "stime" columns. If you double-click on it a few times, you will see snapshots of the stack trace that might suggest what's causing all the GCs.