diff options
| author | Angus Gratton <angus@redyak.com.au> | 2023-08-02 16:49:44 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-08-15 10:48:02 +1000 |
| commit | 519c24dd48764f28593112dbeac7e30b8b2a6240 (patch) | |
| tree | 9ca0435f8687854e29fc34cd92824089f2213c94 /examples/conwaylife.py | |
| parent | d325ee4509d8f68e341d5efc5ddbe3c30f86089e (diff) | |
py/gc: Add new MICROPY_GC_SPLIT_HEAP_AUTO "auto grow heap" mode.
When set, the split heap is automatically extended with new areas on
demand, and shrunk if a heap area becomes empty during a GC pass or soft
reset.
To save code size the size allocation for a new heap block (including
metadata) is estimated at 103% of the failed allocation, rather than
working from the more complex algorithm in gc_try_add_heap(). This appears
to work well except in the extreme limit case when almost all RAM is
exhausted (~last few hundred bytes). However in this case some allocation
is likely to fail soon anyhow.
Currently there is no API to manually add a block of a given size to the
heap, although that could easily be added if necessary.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'examples/conwaylife.py')
0 files changed, 0 insertions, 0 deletions
