More flexible memory analysis with `micropython.mem_info()`
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.
memory allocation ESP32's
Port, board and/or hardware
ESP32-S3 N16R8
MicroPython version
1.23.0
Reproduction
micropython.mem_info(), gc.mem_alloc() and gc.mem_free() are not returning the expected values. I am not 100% sure what is going on. I see in the documentation something about using a split heap but I am not able to locate anywhere in the MicroPython code any of the multi_heap_* functions of the ESP-IDF being used. malloc and other stdlib memory functions are not going to allocate memory or free memory from an esp multi heap.
I don't know if this is a bug or possibly an issue with my understanding of what is going on.... The numbers are not even close to what they should be for having an MCU that has 8mb of external SPIRAM.
Expected behaviour
For the numbers to match up properly.
Observed behaviour
>>> micropython.mem_info()
stack: 736 out of 15360
GC: total: 127936, used: 126336, free: 1600, max new split: 69632
No. of 1-blocks: 2167, 2-blocks: 365, max blk sz: 282, max free sz: 86
>>> gc.mem_alloc()
55792
>>> gc.mem_free()
93616
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree