I am developing an android application for fingerprint reader, my operations include verifying user fingerprint(continuously), and registering new fingerprints(getting fingerprints from web API).
I am using Morpho MSO 1300 fingerprint reader.
when I run my application I am constantly getting following logcat messages
01-02 11:19:48.910 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:49.350 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:49.770 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:50.210 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:50.630 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:51.070 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:51.570 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:52.070 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:52.570 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:53.000 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:53.500 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:53.930 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:54.360 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:54.800 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3633K/4540K, paused 14ms, total 14ms
01-02 11:19:55.300 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 336K, 20% free 3652K/4540K, paused 14ms, total 14ms
01-02 11:19:55.730 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 301K, 20% free 3644K/4540K, paused 14ms, total 14ms
01-02 11:19:56.150 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3644K/4540K, paused 15ms, total 15ms
01-02 11:19:56.600 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3644K/4540K, paused 14ms, total 14ms
01-02 11:19:57.010 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3644K/4540K, paused 14ms, total 14ms
01-02 11:19:57.440 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 295K, 20% free 3644K/4540K, paused 14ms, total 14ms
01-02 11:19:57.880 5286-11417/com.cms.attendance D/dalvikvm:
GC_FOR_ALLOC freed 293K, 20% free 3644K/4540K, paused 14ms, total 14ms
01-02 11:19:58.030 24732-24776/com.baidu.video.pad:download V/P2PBase:
[11:19:58:040][P2PBase] dns : media.p2sp.baidu.com resolve failed.
wait 3
As I increase data in my application, say I get 1000 users from web API and I try to process them and register them in fingerprint reader and sqlite database eventually my application freezes.
Any help will be appreciated.
This log means that Garbage collector just released the memory. You are making a lot of allocations and this is the reason why GC have to work frequently.
I recommend You to use Android Profiler (Android Studio 3.0) and try to overcome this problem: https://developer.android.com/studio/profile/memory-profiler.html
or past your code so that we can think about it together.
I'm having some issues understanding the GC, and Maps V2. On Zoom (in / out) the GC kicks in constantly cleaning up, making the application hang for half a second in the mapview.
If I remove the mapview from the application everything runs fine, but as soon as I add the mapview GC kicks brutal in (On create, and on zoom in /out).
I'm using the supportv4.support.map.fragment. I dont know if I should include layout and code? As this is many classes, and a whole lot of code for a general question.
Would you say this is my fault / Most likely implemented maps wrong? Or caused a memory leak?
Or is this normal behavior? I run the app on my Xperia Z, and it works "ok", but if I try it on my S2 it's a nightmare.
A print of my Logcat going wild :
08-18 00:57:27.759: D/dalvikvm(12809): GC_FOR_ALLOC freed 4796K, 61% free 21315K/54640K, paused 34ms, total 35ms
08-18 00:57:29.681: D/dalvikvm(12809): GC_CONCURRENT freed 5994K, 61% free 21580K/54640K, paused 5ms+5ms, total 53ms
08-18 00:57:29.681: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 36ms
08-18 00:57:32.433: D/dalvikvm(12809): GC_FOR_ALLOC freed 3498K, 61% free 21699K/54640K, paused 67ms, total 67ms
08-18 00:57:32.804: D/dalvikvm(12809): GC_FOR_ALLOC freed 4774K, 61% free 21723K/54640K, paused 33ms, total 34ms
08-18 00:57:32.904: D/dalvikvm(12809): GC_FOR_ALLOC freed 5096K, 62% free 20916K/54640K, paused 31ms, total 32ms
08-18 00:57:33.224: D/dalvikvm(12809): GC_FOR_ALLOC freed 5296K, 62% free 20997K/54640K, paused 32ms, total 33ms
08-18 00:57:33.344: D/dalvikvm(12809): GC_FOR_ALLOC freed 5301K, 62% free 21083K/54640K, paused 30ms, total 31ms
08-18 00:57:33.454: D/dalvikvm(12809): GC_FOR_ALLOC freed 5397K, 63% free 20667K/54640K, paused 35ms, total 36ms
08-18 00:57:33.725: D/dalvikvm(12809): GC_CONCURRENT freed 4481K, 60% free 22222K/54640K, paused 3ms+5ms, total 37ms
08-18 00:57:33.825: D/dalvikvm(12809): GC_FOR_ALLOC freed 6110K, 61% free 21595K/54640K, paused 42ms, total 42ms
08-18 00:57:33.915: D/dalvikvm(12809): GC_CONCURRENT freed 5407K, 59% free 22492K/54640K, paused 3ms+5ms, total 38ms
08-18 00:57:33.915: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 26ms
08-18 00:57:33.915: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 29ms
08-18 00:57:33.995: D/dalvikvm(12809): GC_FOR_ALLOC freed 4654K, 60% free 22322K/54640K, paused 31ms, total 31ms
08-18 00:57:34.155: D/dalvikvm(12809): GC_CONCURRENT freed 5992K, 59% free 22815K/54640K, paused 3ms+4ms, total 34ms
08-18 00:57:34.155: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 28ms
08-18 00:57:34.155: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 26ms
08-18 00:57:34.275: D/dalvikvm(12809): GC_FOR_ALLOC freed 5334K, 58% free 23396K/54640K, paused 33ms, total 40ms
08-18 00:57:34.415: D/dalvikvm(12809): GC_FOR_ALLOC freed 5573K, 58% free 23322K/54640K, paused 45ms, total 45ms
08-18 00:57:34.505: D/dalvikvm(12809): GC_FOR_ALLOC freed 4165K, 58% free 23277K/54640K, paused 33ms, total 33ms
08-18 00:57:34.636: D/dalvikvm(12809): GC_FOR_ALLOC freed 4192K, 58% free 23238K/54640K, paused 41ms, total 42ms
08-18 00:57:34.736: D/dalvikvm(12809): GC_FOR_ALLOC freed 4138K, 58% free 23217K/54640K, paused 37ms, total 37ms
08-18 00:57:34.886: D/dalvikvm(12809): GC_FOR_ALLOC freed 5108K, 56% free 24575K/54640K, paused 46ms, total 46ms
08-18 00:57:35.026: D/dalvikvm(12809): GC_FOR_ALLOC freed 6540K, 56% free 24073K/54640K, paused 51ms, total 52ms
08-18 00:57:35.156: D/dalvikvm(12809): GC_FOR_ALLOC freed 4840K, 55% free 24738K/54640K, paused 31ms, total 31ms
08-18 00:57:35.356: D/dalvikvm(12809): GC_FOR_ALLOC freed 4325K, 55% free 24635K/54640K, paused 38ms, total 38ms
08-18 00:57:35.436: D/dalvikvm(12809): GC_FOR_ALLOC freed 4122K, 55% free 24632K/54640K, paused 35ms, total 35ms
08-18 00:57:35.526: D/dalvikvm(12809): GC_FOR_ALLOC freed 4722K, 57% free 24029K/54640K, paused 34ms, total 34ms
08-18 00:57:35.597: D/dalvikvm(12809): GC_FOR_ALLOC freed 4233K, 57% free 23916K/54640K, paused 32ms, total 32ms
08-18 00:57:36.027: D/dalvikvm(12809): GC_FOR_ALLOC freed 4581K, 57% free 23750K/54640K, paused 34ms, total 35ms
08-18 00:57:36.117: D/dalvikvm(12809): GC_FOR_ALLOC freed 4297K, 57% free 23573K/54640K, paused 32ms, total 33ms
08-18 00:57:36.207: D/dalvikvm(12809): GC_FOR_ALLOC freed 4223K, 58% free 23467K/54640K, paused 31ms, total 32ms
08-18 00:57:36.277: D/dalvikvm(12809): GC_FOR_ALLOC freed 4184K, 58% free 23399K/54640K, paused 31ms, total 31ms
08-18 00:57:36.357: D/dalvikvm(12809): GC_FOR_ALLOC freed 4209K, 58% free 23305K/54640K, paused 31ms, total 31ms
08-18 00:57:36.447: D/dalvikvm(12809): GC_FOR_ALLOC freed 4252K, 58% free 23173K/54640K, paused 35ms, total 35ms
08-18 00:57:36.988: D/dalvikvm(12809): GC_FOR_ALLOC freed 4669K, 58% free 23038K/54640K, paused 35ms, total 36ms
08-18 00:57:37.508: D/dalvikvm(12809): GC_FOR_ALLOC freed 4589K, 59% free 22919K/54640K, paused 54ms, total 55ms
08-18 00:57:38.940: D/dalvikvm(12809): GC_CONCURRENT freed 6052K, 57% free 23609K/54640K, paused 3ms+6ms, total 71ms
08-18 00:57:38.940: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 41ms
08-18 00:57:38.940: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 26ms
08-18 00:57:39.250: D/dalvikvm(12809): GC_FOR_ALLOC freed 6227K, 58% free 23000K/54640K, paused 33ms, total 34ms
08-18 00:57:40.501: D/dalvikvm(12809): GC_CONCURRENT freed 6455K, 58% free 23360K/54640K, paused 3ms+4ms, total 77ms
08-18 00:57:40.501: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 57ms
08-18 00:57:40.822: D/dalvikvm(12809): GC_CONCURRENT freed 7158K, 58% free 23100K/54640K, paused 2ms+5ms, total 38ms
08-18 00:57:40.822: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 23ms
08-18 00:57:41.022: D/dalvikvm(12809): GC_FOR_ALLOC freed 2905K, 57% free 23771K/54640K, paused 37ms, total 38ms
08-18 00:57:41.122: D/dalvikvm(12809): GC_CONCURRENT freed 6499K, 56% free 24292K/54640K, paused 7ms+6ms, total 44ms
08-18 00:57:41.122: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 36ms
08-18 00:57:41.232: D/dalvikvm(12809): GC_FOR_ALLOC freed 5791K, 57% free 23732K/54640K, paused 32ms, total 32ms
08-18 00:57:41.322: D/dalvikvm(12809): GC_FOR_ALLOC freed 4391K, 57% free 23723K/54640K, paused 34ms, total 34ms
08-18 00:57:41.402: D/dalvikvm(12809): GC_FOR_ALLOC freed 4853K, 58% free 22986K/54640K, paused 36ms, total 36ms
08-18 00:57:41.472: D/dalvikvm(12809): GC_FOR_ALLOC freed 4111K, 58% free 22975K/54640K, paused 30ms, total 31ms
08-18 00:57:41.602: D/dalvikvm(12809): GC_CONCURRENT freed 6093K, 57% free 23652K/54640K, paused 3ms+6ms, total 46ms
08-18 00:57:41.602: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 27ms
08-18 00:57:41.602: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 4ms
08-18 00:57:41.702: D/dalvikvm(12809): GC_FOR_ALLOC freed 5077K, 57% free 23645K/54640K, paused 34ms, total 34ms
08-18 00:57:41.783: D/dalvikvm(12809): GC_FOR_ALLOC freed 4265K, 57% free 23495K/54640K, paused 36ms, total 36ms
08-18 00:57:41.993: D/dalvikvm(12809): GC_FOR_ALLOC freed 4500K, 58% free 23113K/54640K, paused 81ms, total 81ms
08-18 00:57:42.083: D/dalvikvm(12809): GC_FOR_ALLOC freed 4842K, 60% free 22385K/54640K, paused 32ms, total 32ms
08-18 00:57:42.824: D/dalvikvm(12809): GC_FOR_ALLOC freed 4872K, 60% free 22271K/54640K, paused 41ms, total 41ms
08-18 00:57:42.934: D/dalvikvm(12809): GC_FOR_ALLOC freed 4732K, 60% free 22288K/54640K, paused 50ms, total 50ms
08-18 00:57:49.941: D/dalvikvm(12809): GC_FOR_ALLOC freed 5747K, 62% free 21152K/54640K, paused 36ms, total 36ms
08-18 00:57:50.081: D/dalvikvm(12809): GC_FOR_ALLOC freed 4324K, 62% free 20956K/54640K, paused 36ms, total 36ms
08-18 00:57:50.221: D/dalvikvm(12809): GC_FOR_ALLOC freed 4134K, 62% free 20925K/54640K, paused 34ms, total 34ms
08-18 00:57:52.193: D/dalvikvm(12809): GC_CONCURRENT freed 5892K, 62% free 21133K/54640K, paused 4ms+8ms, total 51ms
08-18 00:57:52.193: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 33ms
08-18 00:57:52.283: D/dalvikvm(12809): GC_FOR_ALLOC freed 1769K, 60% free 22065K/54640K, paused 38ms, total 38ms
08-18 00:57:52.353: D/dalvikvm(12809): GC_FOR_ALLOC freed 4917K, 61% free 21594K/54640K, paused 31ms, total 32ms
08-18 00:57:52.443: D/dalvikvm(12809): GC_FOR_ALLOC freed 5029K, 63% free 20683K/54640K, paused 31ms, total 31ms
08-18 00:57:52.523: D/dalvikvm(12809): GC_FOR_ALLOC freed 4289K, 63% free 20512K/54640K, paused 32ms, total 32ms
08-18 00:57:52.603: D/dalvikvm(12809): GC_FOR_ALLOC freed 4141K, 63% free 20486K/54640K, paused 32ms, total 32ms
08-18 00:57:52.723: D/dalvikvm(12809): GC_FOR_ALLOC freed 4425K, 62% free 20829K/54640K, paused 29ms, total 30ms
08-18 00:57:53.064: D/dalvikvm(12809): GC_FOR_ALLOC freed 5106K, 62% free 20810K/54640K, paused 40ms, total 41ms
08-18 00:57:56.347: D/dalvikvm(12809): GC_CONCURRENT freed 6009K, 62% free 20820K/54640K, paused 4ms+5ms, total 80ms
08-18 00:57:56.497: D/dalvikvm(12809): GC_FOR_ALLOC freed 2729K, 62% free 20880K/54640K, paused 32ms, total 32ms
08-18 00:57:56.597: D/dalvikvm(12809): GC_FOR_ALLOC freed 4888K, 63% free 20374K/54640K, paused 34ms, total 34ms
08-18 00:57:56.937: D/dalvikvm(12809): GC_FOR_ALLOC freed 5928K, 64% free 20162K/54640K, paused 32ms, total 32ms
08-18 00:57:57.077: D/dalvikvm(12809): GC_CONCURRENT freed 4630K, 61% free 21408K/54640K, paused 3ms+4ms, total 37ms
08-18 00:57:57.077: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 30ms
08-18 00:57:57.077: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 31ms
08-18 00:57:57.077: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 30ms
08-18 00:57:57.238: D/dalvikvm(12809): GC_FOR_ALLOC freed 6073K, 62% free 20893K/54640K, paused 32ms, total 32ms
08-18 00:57:57.318: D/dalvikvm(12809): GC_FOR_ALLOC freed 4142K, 62% free 20868K/54640K, paused 31ms, total 31ms
08-18 00:57:57.818: D/dalvikvm(12809): GC_FOR_ALLOC freed 4675K, 62% free 20893K/54640K, paused 34ms, total 35ms
08-18 00:57:57.898: D/dalvikvm(12809): GC_FOR_ALLOC freed 4127K, 62% free 20884K/54640K, paused 30ms, total 31ms
08-18 00:57:57.968: D/dalvikvm(12809): GC_FOR_ALLOC freed 4208K, 62% free 20798K/54640K, paused 30ms, total 30ms
08-18 00:57:58.179: D/dalvikvm(12809): GC_FOR_ALLOC freed 5894K, 63% free 20313K/54640K, paused 30ms, total 30ms
08-18 00:57:58.919: D/dalvikvm(12809): GC_CONCURRENT freed 5791K, 63% free 20421K/54640K, paused 2ms+4ms, total 40ms
08-18 00:57:58.919: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 35ms
08-18 00:57:59.079: D/dalvikvm(12809): GC_FOR_ALLOC freed 5360K, 63% free 20334K/54640K, paused 33ms, total 34ms
08-18 00:57:59.300: D/dalvikvm(12809): GC_CONCURRENT freed 5742K, 63% free 20509K/54640K, paused 3ms+14ms, total 119ms
08-18 00:57:59.310: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 12ms
08-18 00:57:59.690: D/dalvikvm(12809): GC_FOR_ALLOC freed 2021K, 61% free 21445K/54640K, paused 42ms, total 44ms
08-18 00:57:59.830: D/dalvikvm(12809): GC_FOR_ALLOC freed 5660K, 60% free 21941K/54640K, paused 42ms, total 42ms
08-18 00:57:59.930: D/dalvikvm(12809): GC_FOR_ALLOC freed 5045K, 60% free 22231K/54640K, paused 32ms, total 32ms
08-18 00:58:00.040: D/dalvikvm(12809): GC_FOR_ALLOC freed 4584K, 60% free 22140K/54640K, paused 54ms, total 54ms
08-18 00:58:00.130: D/dalvikvm(12809): GC_FOR_ALLOC freed 4670K, 61% free 21591K/54640K, paused 34ms, total 35ms
08-18 00:58:00.221: D/dalvikvm(12809): GC_FOR_ALLOC freed 4148K, 61% free 21562K/54640K, paused 30ms, total 30ms
08-18 00:58:00.321: D/dalvikvm(12809): GC_FOR_ALLOC freed 4164K, 61% free 21519K/54640K, paused 30ms, total 30ms
08-18 00:58:00.401: D/dalvikvm(12809): GC_FOR_ALLOC freed 4217K, 61% free 21417K/54640K, paused 29ms, total 29ms
08-18 00:58:00.471: D/dalvikvm(12809): GC_FOR_ALLOC freed 4105K, 61% free 21416K/54640K, paused 27ms, total 27ms
08-18 00:58:00.611: D/dalvikvm(12809): GC_FOR_ALLOC freed 4794K, 61% free 21371K/54640K, paused 33ms, total 34ms
08-18 00:58:00.681: D/dalvikvm(12809): GC_FOR_ALLOC freed 4107K, 61% free 21370K/54640K, paused 29ms, total 30ms
08-18 00:58:02.393: D/dalvikvm(12809): GC_FOR_ALLOC freed 5465K, 61% free 21435K/54640K, paused 33ms, total 33ms
08-18 00:58:02.523: D/dalvikvm(12809): GC_FOR_ALLOC freed 4571K, 59% free 22563K/54640K, paused 31ms, total 31ms
08-18 00:58:03.614: D/dalvikvm(12809): GC_FOR_ALLOC freed 6525K, 61% free 21447K/54640K, paused 39ms, total 39ms
08-18 00:58:03.724: D/dalvikvm(12809): GC_FOR_ALLOC freed 4316K, 61% free 21581K/54640K, paused 42ms, total 42ms
08-18 00:58:05.015: D/dalvikvm(12809): GC_CONCURRENT freed 5834K, 60% free 21992K/54640K, paused 3ms+6ms, total 43ms
08-18 00:58:06.056: D/dalvikvm(12809): GC_CONCURRENT freed 6081K, 60% free 22291K/54640K, paused 3ms+7ms, total 43ms
08-18 00:58:06.056: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 29ms
08-18 00:58:06.677: D/dalvikvm(12809): JIT code cache reset in 1 ms (1048524 bytes 2/0)
08-18 00:58:06.687: D/dalvikvm(12809): GC_CONCURRENT freed 7111K, 61% free 21744K/54640K, paused 3ms+7ms, total 55ms
08-18 00:58:06.687: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 19ms
08-18 00:58:08.278: D/dalvikvm(12809): GC_FOR_ALLOC freed 4619K, 60% free 22283K/54640K, paused 45ms, total 45ms
08-18 00:58:08.389: D/dalvikvm(12809): GC_FOR_ALLOC freed 5813K, 59% free 22471K/54640K, paused 33ms, total 33ms
08-18 00:58:08.469: D/dalvikvm(12809): GC_FOR_ALLOC freed 4225K, 60% free 22366K/54640K, paused 31ms, total 31ms
08-18 00:58:08.549: D/dalvikvm(12809): GC_FOR_ALLOC freed 4363K, 60% free 22122K/54640K, paused 32ms, total 32ms
08-18 00:58:08.789: D/dalvikvm(12809): GC_FOR_ALLOC freed 5598K, 60% free 21959K/54640K, paused 33ms, total 33ms
08-18 00:58:08.869: D/dalvikvm(12809): GC_FOR_ALLOC freed 4264K, 61% free 21812K/54640K, paused 31ms, total 32ms
08-18 00:58:08.949: D/dalvikvm(12809): GC_FOR_ALLOC freed 4332K, 61% free 21595K/54640K, paused 30ms, total 30ms
08-18 00:58:09.019: D/dalvikvm(12809): GC_FOR_ALLOC freed 4344K, 61% free 21371K/54640K, paused 29ms, total 29ms
08-18 00:58:09.109: D/dalvikvm(12809): GC_FOR_ALLOC freed 4273K, 62% free 21234K/54640K, paused 29ms, total 30ms
08-18 00:58:09.349: D/dalvikvm(12809): GC_FOR_ALLOC freed 5486K, 61% free 21376K/54640K, paused 30ms, total 30ms
08-18 00:58:09.450: D/dalvikvm(12809): GC_FOR_ALLOC freed 4512K, 61% free 21369K/54640K, paused 30ms, total 31ms
08-18 00:58:10.270: D/dalvikvm(12809): GC_FOR_ALLOC freed 4973K, 61% free 21620K/54640K, paused 32ms, total 33ms
08-18 00:58:10.370: D/dalvikvm(12809): GC_FOR_ALLOC freed 4236K, 61% free 21641K/54640K, paused 34ms, total 34ms
08-18 00:58:10.471: D/dalvikvm(12809): GC_FOR_ALLOC freed 4620K, 61% free 21365K/54640K, paused 32ms, total 32ms
08-18 00:58:10.541: D/dalvikvm(12809): GC_FOR_ALLOC freed 4108K, 61% free 21365K/54640K, paused 30ms, total 30ms
08-18 00:58:12.232: D/dalvikvm(12809): GC_FOR_ALLOC freed 5405K, 61% free 21615K/54640K, paused 35ms, total 35ms
08-18 00:58:12.382: D/dalvikvm(12809): GC_CONCURRENT freed 5083K, 59% free 22860K/54640K, paused 4ms+5ms, total 40ms
08-18 00:58:12.382: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 31ms
08-18 00:58:12.382: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 2ms
08-18 00:58:12.472: D/dalvikvm(12809): GC_FOR_ALLOC freed 4242K, 59% free 22790K/54640K, paused 31ms, total 31ms
08-18 00:58:12.553: D/dalvikvm(12809): GC_FOR_ALLOC freed 4204K, 59% free 22702K/54640K, paused 32ms, total 32ms
08-18 00:58:13.113: D/dalvikvm(12809): GC_FOR_ALLOC freed 5858K, 59% free 22847K/54640K, paused 37ms, total 38ms
08-18 00:58:13.223: D/dalvikvm(12809): GC_FOR_ALLOC freed 4548K, 59% free 22712K/54640K, paused 33ms, total 33ms
08-18 00:58:13.323: D/dalvikvm(12809): GC_FOR_ALLOC freed 4339K, 59% free 22625K/54640K, paused 30ms, total 31ms
08-18 00:58:13.413: D/dalvikvm(12809): GC_FOR_ALLOC freed 5406K, 61% free 21599K/54640K, paused 30ms, total 31ms
08-18 00:58:13.604: D/dalvikvm(12809): GC_CONCURRENT freed 6158K, 61% free 21733K/54640K, paused 2ms+4ms, total 38ms
08-18 00:58:13.614: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 32ms
08-18 00:58:15.005: D/dalvikvm(12809): GC_FOR_ALLOC freed 4289K, 59% free 22877K/54640K, paused 35ms, total 35ms
08-18 00:58:15.095: D/dalvikvm(12809): GC_FOR_ALLOC freed 4504K, 59% free 22520K/54640K, paused 31ms, total 31ms
08-18 00:58:15.175: D/dalvikvm(12809): GC_FOR_ALLOC freed 4684K, 60% free 21950K/54640K, paused 30ms, total 30ms
08-18 00:58:15.245: D/dalvikvm(12809): GC_FOR_ALLOC freed 4162K, 60% free 21904K/54640K, paused 29ms, total 30ms
08-18 00:58:16.176: D/dalvikvm(12809): GC_CONCURRENT freed 5225K, 58% free 23043K/54640K, paused 3ms+7ms, total 64ms
08-18 00:58:16.276: D/dalvikvm(12809): GC_FOR_ALLOC freed 4773K, 57% free 23539K/54640K, paused 33ms, total 33ms
08-18 00:58:16.376: D/dalvikvm(12809): GC_FOR_ALLOC freed 4421K, 57% free 23510K/54640K, paused 31ms, total 32ms
08-18 00:58:16.456: D/dalvikvm(12809): GC_FOR_ALLOC freed 4215K, 58% free 23474K/54640K, paused 30ms, total 30ms
08-18 00:58:16.827: D/dalvikvm(12809): GC_FOR_ALLOC freed 5377K, 59% free 22494K/54640K, paused 38ms, total 39ms
08-18 00:58:16.917: D/dalvikvm(12809): GC_FOR_ALLOC freed 4138K, 59% free 22476K/54640K, paused 31ms, total 32ms
08-18 00:58:16.987: D/dalvikvm(12809): GC_FOR_ALLOC freed 4263K, 60% free 22324K/54640K, paused 30ms, total 31ms
08-18 00:58:18.909: D/dalvikvm(12809): GC_FOR_ALLOC freed 5483K, 60% free 22387K/54640K, paused 33ms, total 34ms
08-18 00:58:19.009: D/dalvikvm(12809): GC_FOR_ALLOC freed 4107K, 60% free 22382K/54640K, paused 39ms, total 39ms
08-18 00:58:19.119: D/dalvikvm(12809): GC_FOR_ALLOC freed 4455K, 60% free 22348K/54640K, paused 35ms, total 35ms
08-18 00:58:21.902: D/dalvikvm(12809): GC_FOR_ALLOC freed 7009K, 61% free 21810K/54640K, paused 38ms, total 38ms
08-18 00:58:22.112: D/dalvikvm(12809): GC_CONCURRENT freed 5015K, 58% free 23221K/54640K, paused 3ms+4ms, total 38ms
08-18 00:58:22.112: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 28ms
08-18 00:58:22.112: D/dalvikvm(12809): WAIT_FOR_CONCURRENT_GC blocked 30ms
08-18 00:58:22.232: D/dalvikvm(12809): GC_FOR_ALLOC freed 5467K, 60% free 22264K/54640K, paused 30ms, total 30ms
08-18 00:58:22.302: D/dalvikvm(12809): GC_FOR_ALLOC freed 4119K, 60% free 22264K/54640K, paused 31ms, total 31ms
08-18 00:58:22.372: D/dalvikvm(12809): GC_FOR_ALLOC freed 4100K, 60% free 22263K/54640K, paused 30ms, total 30ms
I am developing on Android 2.3.3 API Lv10. My app uses the 'LoaderManager' interface to load images in the background, and the images are displayed in a ViewPager. If I repeat viewing the images, the app will crash eventually. It looks like the app allocate memory to fast, and the GC is not able to release some of it.
Is there any way to track which object is hold in memory?
02-02 18:02:05.564: D/dalvikvm(255): GC_EXPLICIT freed 500K, 55% free 2599K/5703K, external 1625K/2137K, paused 534ms
02-02 18:02:05.714: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 365K, 54% free 2680K/5703K, external 3045K/3338K, paused 54ms
02-02 18:02:06.074: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 59K, 54% free 2677K/5703K, external 4211K/5259K, paused 62ms
02-02 18:02:10.645: D/dalvikvm(316): GC_EXPLICIT freed 322K, **54% free** 2539K/5511K, external 1625K/2137K, paused 100ms
02-02 18:02:53.054: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 109K, **53% free** 2684K/5703K, external 6691K/6808K, paused 48ms
02-02 18:03:16.834: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 604K, 55% free 2720K/5959K, external 8954K/9904K, paused 52ms
02-02 18:03:18.304: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 114K, 55% free 2711K/5959K, external 6160K/6211K, paused 47ms
02-02 18:03:21.534: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 128K, 55% free 2731K/5959K, external 8375K/9165K, paused 38ms
02-02 18:03:29.154: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 612K, 55% free 2757K/6023K, external 10236K/11261K, paused 50ms
02-02 18:03:30.394: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 90K, 55% free 2719K/6023K, external 8070K/8080K, paused 45ms
02-02 18:03:33.944: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 571K, 54% free 2786K/6023K, external 9093K/10112K, paused 74ms
02-02 18:03:36.304: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 115K, 54% free 2777K/6023K, external 7952K/8724K, paused 45ms
02-02 18:03:41.194: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 319K, 53% free 2877K/6023K, external 10954K/10980K, paused 51ms
02-02 18:03:58.054: I/dalvikvm(389): Jit: resizing JitTable from 512 to 1024
02-02 18:03:58.454: D/dalvikvm(389): GC_CONCURRENT freed 1254K, 58% free 2841K/6727K, external 8152K/8375K, paused 4ms+5ms
02-02 18:04:01.314: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 80K, 58% free 2847K/6727K, external 8078K/8375K, paused 57ms
02-02 18:04:02.244: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 66K, 58% free 2884K/6727K, external 10625K/11366K, paused 40ms
02-02 18:04:07.614: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 191K, 58% free 2874K/6727K, external 13698K/14474K, paused 49ms
02-02 18:04:16.104: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 566K, 57% free 2925K/6727K, external 12504K/12547K, paused 41ms
02-02 18:04:16.574: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 194K, 58% free 2837K/6727K, external 8589K/9589K, paused 51ms
02-02 18:04:18.774: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 71K, 58% free 2862K/6727K, external 9048K/11075K, paused 40ms
02-02 18:04:20.705: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 108K, 58% free 2859K/6727K, external 11804K/12545K, paused 49ms
02-02 18:04:22.475: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 52K, 58% free 2861K/6727K, external 14210K/16258K, paused 40ms
02-02 18:04:24.044: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 52K, 58% free 2863K/6727K, external 16920K/18968K, paused 47ms
02-02 18:04:24.153: E/dalvikvm-heap(389): 1232160-byte external allocation too large for this process.
02-02 18:04:24.255: D/dalvikvm(389): GC_FOR_MALLOC freed <1K, 58% free 2863K/6727K, external 16920K/18968K, paused 29ms
02-02 18:04:24.265: W/dalvikvm(389): threadid=9: thread exiting with uncaught exception (group=0x40015560)
02-02 18:04:24.565: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 91K, 58% free 2850K/6727K, external 16967K/18968K, paused 149ms
02-02 18:04:25.664: D/dalvikvm(389): GC_FOR_MALLOC freed 0K, 58% free 2850K/6727K, external 17021K/18968K, paused 161ms
02-02 18:04:27.144: D/dalvikvm(389): GC_EXTERNAL_ALLOC freed 39K, 58% free 2880K/6727K, external 17000K/18968K, paused 49ms
02-02 18:04:27.364: I/dalvikvm-heap(389): Clamp target GC heap from 24.004MB to 24.000MB
02-02 18:04:27.374: D/dalvikvm(389): GC_FOR_MALLOC freed <1K, 58% free 2880K/6727K, external 17048K/18968K, paused 29ms
02-02 17:48:09.424: D/dalvikvm(337): GC_CONCURRENT freed 1400K, 61% free 2686K/6727K, external 3045K/3330K, paused 4ms+4ms
02-02 17:48:10.284: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 58K, 60% free 2707K/6727K, external 2972K/3330K, paused 37ms
02-02 17:48:11.664: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 78K, 60% free 2709K/6727K, external 3842K/4799K, paused 44ms
02-02 17:48:17.364: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 161K, 60% free 2719K/6727K, external 5843K/6032K, paused 41ms
02-02 17:48:25.824: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 157K, 60% free 2726K/6727K, external 8108K/8682K, paused 76ms
02-02 17:48:30.084: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 157K, 60% free 2732K/6727K, external 10488K/11355K, paused 63ms
02-02 17:48:39.704: D/dalvikvm(337): GC_CONCURRENT freed 742K, 58% free 2888K/6727K, external 12840K/13865K, paused 4ms+3ms
02-02 17:48:43.895: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 893K, 60% free 2749K/6727K, external 3941K/4896K, paused 52ms
02-02 17:48:58.414: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 160K, 60% free 2750K/6727K, external 6400K/6445K, paused 55ms
02-02 17:49:02.324: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 375K, 59% free 2821K/6727K, external 9503K/9541K, paused 43ms
02-02 17:49:03.755: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 320K, 59% free 2777K/6727K, external 4944K/5945K, paused 69ms
02-02 17:49:08.184: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 212K, 59% free 2767K/6727K, external 7593K/7630K, paused 46ms
02-02 17:49:10.914: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 451K, 59% free 2805K/6727K, external 5893K/6353K, paused 50ms
02-02 17:49:15.294: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 163K, 58% free 2843K/6727K, external 9263K/9265K, paused 39ms
02-02 17:49:16.434: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 499K, 58% free 2835K/6727K, external 6842K/7538K, paused 76ms
02-02 17:49:18.824: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 109K, 58% free 2831K/6727K, external 9008K/9765K, paused 43ms
02-02 17:49:25.774: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 645K, 59% free 2816K/6727K, external 12225K/12235K, paused 53ms
02-02 17:49:35.494: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 60K, 58% free 2864K/6727K, external 10256K/12304K, paused 54ms
02-02 17:49:59.824: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 1593K, 60% free 2905K/7111K, external 13747K/14632K, paused 58ms
02-02 17:50:02.764: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 114K, 59% free 2927K/7111K, external 11181K/12092K, paused 73ms
02-02 17:50:04.605: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 151K, 59% free 2935K/7111K, external 13655K/14466K, paused 47ms
02-02 17:50:09.174: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 513K, 59% free 2970K/7111K, external 15783K/15803K, paused 49ms
02-02 17:50:14.434: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 247K, 59% free 2926K/7111K, external 11360K/11714K, paused 52ms
02-02 17:50:20.464: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 608K, 59% free 2960K/7111K, external 13909K/14934K, paused 50ms
02-02 17:50:24.415: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 143K, 59% free 2980K/7111K, external 14651K/15393K, paused 43ms
02-02 17:50:24.655: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed 0K, 59% free 2980K/7111K, external 14651K/15393K, paused 49ms
02-02 17:50:24.725: I/dalvikvm-heap(337): Clamp target GC heap from 24.113MB to 24.000MB
02-02 17:50:24.725: D/dalvikvm(337): GC_FOR_MALLOC freed <1K, 59% free 2980K/7111K, external 17058K/19106K, paused 59ms
02-02 17:50:24.805: D/dalvikvm(337): GC_EXTERNAL_ALLOC freed <1K, 59% free 2980K/7111K, external 17058K/19106K, paused 69ms
02-02 17:50:25.045: E/dalvikvm-heap(337): 2774400-byte external allocation too large for this process.
02-02 17:50:25.115: I/dalvikvm-heap(337): Clamp target GC heap from 24.112MB to 24.000MB
02-02 17:50:25.115: D/dalvikvm(337): GC_FOR_MALLOC freed 0K, 59% free 2980K/7111K, external 17058K/19106K, paused 56ms
02-02 17:50:25.304: E/GraphicsJNI(337): VM won't let us allocate 2774400 bytes
The links given by #JoxTraex are great. But to this issue, I finally found the root cause. It is the LoaderManager which holds a reference to the Loader object and the object returned by the Loader.loadInBackground method. After calling the LoaderManager.destroyLoader(id), the problem is gone forever.
This is quite a topic that is kind of hard to tackle, specifically if you keep a reference to your Bitmaps, then you start overloading memory. This is because images are VERY heavy in terms of memory/VM. You should have a look at what Romain Guy says about graphics and Bitmaps and how to handle it.
Here:
http://www.youtube.com/watch?v=duefsFTJXzc
http://www.youtube.com/watch?v=wJYTBjMZJh0
They are lengthy videos, but have lots of good information and some of this includes how to handle this with best practices.