-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Enhancement
When working in a constrained environment (e.g. NXP1768) with increasingly large applications (e.g. mbedClient), being able to track what's happening to the available RAM is really important. The current run-time stats are good but not quite good enough: one can add calls to mbed_stats_heap_get() throughout the visible code, but that does not account for the stuff that happens in libraries and, also, it does not allow you to see what that last fatal failed malloc() that triggered the "Operator new out of memory" was for: was it a few 10's of bytes, easy to free up, or was it for a 4k block, in which case give up and go home?
What would be useful for these situations, as @0xc0170 suggested, is a hook into malloc() and free() allowing each attempt to deploy heap to be logged by the user. Then you can really see what's happening and decide whether it's time to go home or not.