I had following experience on my Nokia 6600 : my application needs around 1.7 MB of heap memory to run and consists of four modules that all allocate memory at different times. At startup, the first three modules allocate memory almost worth the 1.7 MB. At some stage in the program, module 3 frees its memory ( which is the biggest chunk, around 1 MB ) and then allocates again. Also, module 4 allocates memory but runs out of it, although it needs not much. Modules 1 and 2 stay untouched all the time.
What puzzles me a bit, is that the overall memory consumption in the startup situation is higher than later in the program and there it does not run out of memory.
So far, I don't feel desperate about this problem, yet. My guess is that the cause is some memory fragmentation. Anyone have an idea?
Also, does anyone know how memory is allocated ( always seqential chunks, beginning at "lowest" address? ) ?
Also, is it possible to defragment the heap during runtime? I heard something like this but don't know.
Thanks for any suggestions!!