We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
The software I am working on is written in c++ and uses the RTX RTOS. The program creates instances of module classes according to a configuration string. These are deleted and then remade if this string is altered.
After a few iterations the program hangs during a call to new which I am assuming is because it ran out of heap space. What I would like to do is monitor the amount of heap available and check that modules free all the memory they are allocated when they are deleted.
Could anyone offer some advice on detecting memory leaks or a method of monitoring the heap usuage?
Many Thanks
what about RTX? doesn't it have a memory manager?
It has a memory manager for fixed-size objects. For variable-sized objects, the normal runtime library functions must be used.
Info from http://www.keil.com/support/man/docs/rlarm/rlarm_ar_mbx_using.htm
"The fixed block memory allocation functions are fully reentrant. The variable length memory allocation functions are not reentrant. Therefore the system timer interrupts need to be disabled during the execution of the malloc() or free() function. Function tsk_lock() disables timer interrupts and function tsk_unlock() enables timer interrupts."