py/gc & esp32: Include largest free block in gc.mem_free() if MICROPY_GC_SPLIT_HEAP_AUTO is enabled - #12366
Conversation
|
Code size report: |
Codecov Report
@@ Coverage Diff @@
## master #12366 +/- ##
==========================================
- Coverage 98.38% 98.38% -0.01%
==========================================
Files 158 158
Lines 20940 20933 -7
==========================================
- Hits 20602 20595 -7
Misses 338 338
|
|
Note to reviewers. I made the comments in #12316 which prompted this change. So I downloaded this PR as a patch and git applied it to the latest MP tree which I then tested across a couple of different ESP32 boards and can confirm that it works well. |
jimmo
left a comment
There was a problem hiding this comment.
Thanks @projectgus - I like the way you've kept it as a separate field in gc_info as well as the mem_info output.
I'm a little bit iffy on the "by Python code" docs change because it might give the wrong impression, but overall I think it's a net positive change and instead the time could be better spent on a more comprehensive guide to the way memory works in MicroPython that can explain the nuances with more context.
I think that would be really useful! |
00f13e4 to
b0da5cb
Compare
Follow-up to 519c24d when MICROPY_GC_SPLIT_HEAP_AUTO is enabled, based on discussion at https://github.com/orgs/micropython/discussions/12316#discussioncomment-6858007 gc.mem_free() is always a heuristic, but this makes it a more useful heuristic for common use cases. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Signed-off-by: Angus Gratton <angus@redyak.com.au>
As raised in discussions of the ESP32 memory management changes. Signed-off-by: Angus Gratton <angus@redyak.com.au>
b0da5cb to
92f379c
Compare
This is a follow-up to #12141 based on discussions in #12316, and changes the behaviour of the esp32 port only.
gc.mem_free(), to give a more accurate impression of how much RAM is available for Python code to use.gc.mem_alloc()andgc.mem_free()functions are relevant for Python allocations only.This work was funded through GitHub Sponsors.