QUERY · ISSUE
gc threshold calculation in docs/reference/constrained
docs
This has
gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4)
which sets the threshold to 1/4 of the total RAM regardless of the amount allocated. Shouldn't this read
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
to account for RAM already allocated?
CANDIDATE · PULL REQUEST
py/gc & esp32: Include largest free block in gc.mem_free() if MICROPY_GC_SPLIT_HEAP_AUTO is enabled
port-esp32py-core
This is a follow-up to #12141 based on discussions in #12316, and changes the behaviour of the esp32 port only.
- Add the "max new split" value to the result of
gc.mem_free(), to give a more accurate impression of how much RAM is available for Python code to use. - Update esp32 docs to match, and clarify that
gc.mem_alloc()andgc.mem_free()functions are relevant for Python allocations only.
This work was funded through GitHub Sponsors.