What does fragmented memory look like? <p>I have a mobile application that is suffering from slow-down over time. My hunch, (In part fed by <a href="http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_avoidingmemoryfragment.jsp" rel="nofollow noreferrer">this article</a>,) is that this is due to fragmentation of memory slowing the app down, but I'm not sure. Here's a pretty graph of the app's memory use over time:</p> <p><img src="http://kupio.com/image-dump/fragmented.png" alt="fraggle rock"></p> <p>The 4 peaks on the graph are 4 executions of the exact same task on the app. I start the task, it allocates a bunch of memory, it sits for a bit (The flat line on top) and then I stop the task. At that point it calls System.gc(); and the memory gets cleaned up.</p> <p>As can be seen, each of the 4 runs of the exact same task take longer to execute. The low-points in the graph all return to the same level so there do not seem to be any memory leaks between task runs.</p> <p>What I want to know is, is memory fragmentation a feasible explanation or should I look elsewhere first, bearing in mind that I've already done a lot of looking? The low-points on the graph are relatively low so my assumption is that in this state the memory would not be very fragmented since there can't be a lot of small memory holes to be causing problems.</p> <p>I don't know how the j2me memory allocator works though, so I really don't know. Can anyone advise? Has anyone else had problems with this and recognises the memory profile of the app?</p>