QUERY · ISSUE
More flexible memory analysis with `micropython.mem_info()`
enhancement
I think it would be a good idea to make micropython.mem_info(1) yields table of heap utilisation in a specific format in a streaming manner. It could be used to analyise and profile memory on another device easily. This idea also applies to micropython.mem_info() as it just prints some stuff and not returning anything.
CANDIDATE · ISSUE
mem_info reports impossible values
Tracing m_malloc() and m_free() calls, it looks like the free rarely gets called, so the reported memory usage keeps climbing and current_bytes_allocated is significantly larger (34KB) than the heap + stack (29KB) after a while:
>>> micropython.mem_info()
mem: total=43806, current=33642, peak=34475
stack: 428 out of 5512
GC: total: 24000, used: 7888, free: 16112
No. of 1-blocks: 184, 2-blocks: 26, max blk sz: 18, max free sz: 373
This might be a bug in my port; I'm using the minimal gc_collect() that has a comment about it "may function incorrectly".