-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Description
- Type: Enhancement
- Related issue: Heap tracking hook #4573, ...
- Priority: Major
Enhancement
Reason to enhance or problem with existing solution
memory traces are good when analysing fragmentation or who is spending memory in very low level (caller level). But it doesn't tell anything about real heap usage or malloc overheads. memory traces are also very heavy because it prints line to stdout every time when some alloc (malloc, free, realloc,..) is called, so it cannot be activated in all cases, e.g. "end-user" applications which start failing if memory traces takes too much cpu/io time.
There is already API to fetch heap state but that is application level API - so application needs interaction to get heap state to get printed out.
Suggested enhancement
If we could have similar feature than memory-trace, which prints heap state every time when it changes so application doesn't need to care about it at all. This approach would be also much more light because heap state doesn't change so often compared to malloc calls (memory traces). Feature could be behind compile time flag so it doesn't affect performance if it is not activated.
This should be quite easy to implement in gcc at least. IAR/armcc might be more complicated.
Pros
- allows to track heap consumption using mbed-traces "in background"
- we could collect memory usage from every test applications without any changes to applications - just by activating it in compiling time (otherwise we have to create dedicated "memory" tests which tells memory consumption only for that use-case, nothing more)
- all tests we have could benefits from this
- tells exactly how much memory is needed for certain use-case
- we could create common tools (in host side) top of this feature
- could fulfill memory-trace analyse results
Cons
some work.