I have a fairly memory intensive process that can cause the heap size to grow near its limits (like 24 in this case).
However, when that process ends, and the Allocated memory (as listed in the DDMS Heap tool and in a heap dump) is far far lower like 6 or 7.
Despite the Allocated memory being low, and there being a lot of free memory, the heap doesn't seem to come back down.
So even though it says there is plenty of memory available I can still get out of memory errors in this case.
So it begs a couple questions:
Even though the Allocated memory in the Heap tab of DDMS and the heap dumps themselves only show 7mb of memory as allocated is there hidden memory that is not mentioned that is not being garbage collected? If so, how do I track this down?
It seems out of memory errors are based on heap size, not allocated memory size. So is there a way to force the heap size to come back down when it doesn't need to be so high when the memory intensive process is over?
Thanks for your insights.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…