I'm working on a function that does a lot of dynamic memory allocation, however, if this function exceeds a threshold of time, the timer fires. Hence, we need to free all the memory allocated when we started this function.
We use a third party tool to create a heap pool when we enter the function. Hence, any dynamic memory allocation will be from this heap pool. If the timer fires, we just free this heap pool, and the code continues working with the heap pool before it (it is like a stack of pools).
We need to stop using this third party tool due to cost.
Does any one have a solution idea for this issue to replace this third party tool?
Note: it is not a multi-threaded system.
Thanks in advance.