Hi All, I have developed an application in Android which is frequently facing memory issues. The application deals with heavy amounts of data but the heap size pattern is a bit baffling to me. Will be great if someone can share his/her thoughts.
1) When the process requires a chunk of new memory, it grows the heap by some amount. For example: Stats at a point of time: Maximum availbale memory: 24.0 Total memory : 8.507782 Free memory : 4.6412277 Used memory : 3.8673096 VM requires to increase memory the stats becomes: Maximum availbale memory: 24.0 Total memory : 9.070282 Free memory : 2.1964188 Used memory : 6.8746185 Upto this looks fine, but immediately after the GC collects, and stats become Maximum availbale memory: 24.0 Total memory : 9.070282 Free memory : 4.1707535 Used memory : 4.900276 Total memory remains at 9 and Free mem becomes larger. My question is, Is the free memory really free? Because in a situation like this, I suddenly get 54540-byte external allocation too large for this process java.lang.OutOfMemoryError: bitmap size exceeds VM budget How with an available free memory of 4.17 MB, 54 KB allocation is not possible? Also, an important point would be, the outofmemory is always about allocating memory for bitmap. 2) Between step 1 and step 2 in previous point, I see a log: Grow heap (frag case) to 17.651MB for 522256-byte allocation This is very baffling as Total memory has increased from 8.5 to 9 but it reports to have increased the heap size to 17.651 MB. I can guarantee the memory stats are correct because both System.freeMemory () etc and DDMS view show the same memory stats. Can someone explain how can this happen? Thanks in advance Rudra -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

