Android OOM, memory is never released-Collection of common programming errors
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
Originally posted 2013-11-27 11:52:54.