diff options
| author | Angus Gratton <angus@redyak.com.au> | 2023-09-05 10:58:19 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-09-15 12:19:13 +1000 |
| commit | 3e8aed9fcce9068f40780b23148feaa1e041a18a (patch) | |
| tree | 9771d7460caf22d8ec28c53e7c2560ff0445dfb4 /py/gc.c | |
| parent | 174bb28d8e27c7b082d2c8d7b18f7bf2cdf2c62e (diff) | |
py/gc: Add "max new split" value in result of gc.mem_free().
Follow-up to 519c24dd487 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>
Diffstat (limited to 'py/gc.c')
| -rw-r--r-- | py/gc.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -701,6 +701,11 @@ void gc_info(gc_info_t *info) { info->used *= BYTES_PER_BLOCK; info->free *= BYTES_PER_BLOCK; + + #if MICROPY_GC_SPLIT_HEAP_AUTO + info->max_new_split = gc_get_max_new_split(); + #endif + GC_EXIT(); } @@ -1159,7 +1164,7 @@ void gc_dump_info(const mp_print_t *print) { mp_printf(print, "GC: total: %u, used: %u, free: %u", (uint)info.total, (uint)info.used, (uint)info.free); #if MICROPY_GC_SPLIT_HEAP_AUTO - mp_printf(print, ", max new split: %u", (uint)gc_get_max_new_split()); + mp_printf(print, ", max new split: %u", (uint)info.max_new_split); #endif mp_printf(print, "\n No. of 1-blocks: %u, 2-blocks: %u, max blk sz: %u, max free sz: %u\n", (uint)info.num_1block, (uint)info.num_2block, (uint)info.max_block, (uint)info.max_free); |
