Hi,
Is there a way to find out how much memory is left on the heap in runtime or with other words, how much memory is free to use malloc ?
Luc Vercruysse
There are 2 ANSI C functions available in stdlib.h __heapstats () __heapvalid () See usage note in the help file or google but probably not provide any useful infos.
kom.
Just remember that most embedded devics are far better off by avoiding dynamic memory - or at least avoiding the use of a traditional heap.
It's so hard to deduce how it behave after having been running for 6 months without a reboot - memory fragmentation can make the usable blocks smaller and smaller.
Most times, it's better to have a fixed number of fixed-size blocks in a pool. For example for buffering TCP/IP packets. Maybe have one pool of N large memory blocks, and another pool of M small memory blocks.