diff options
author | Angus Gratton <angus@redyak.com.au> | 2024-12-04 10:58:06 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-02-03 15:02:02 +1100 |
commit | 40e1c111e17864044190596dff6d32955d11280c (patch) | |
tree | 55eb42d4b6a88feedecbc0009ae4a8dbd57faa31 /py/mpthread.h | |
parent | 8a2ff2ca7366f605dd55c93f6b393552b365cd10 (diff) | |
download | micropython-40e1c111e17864044190596dff6d32955d11280c.tar.gz micropython-40e1c111e17864044190596dff6d32955d11280c.zip |
py/gc: Allow gc_free from inside a gc_sweep finalizer.
Do this by tracking being inside gc collection with a
separate flag, GC_COLLECT_FLAG. In gc_free(),
ignore this flag when determining if the heap is locked.
* For finalisers calling gc_free() when heap is otherwise unlocked,
this allows memory to be immediately freed (potentially
avoiding a MemoryError).
* Hard IRQs still can't call gc_free(), as heap will be locked via
gc_lock().
* If finalisers are disabled then all of this code can be compiled
out to save some code size.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'py/mpthread.h')
0 files changed, 0 insertions, 0 deletions