You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently implemented incremental garbage collection on Micropython.
This enables incremental (partial) GC running, it eliminates stop-the-world GC.
It also recognizes data allocations such as bytearray. GC will skip scan when the allocation is marked as data.
It's great for timing-critical applications such as graphic app.
I can keep 50fps on my graphic application with GC running background.
I originally made the change for my product(Pocket Deck) and I ported to recent MP build.
I know Micropython's GC is designed simple on purpose, so I don't have a plan to send any PR.
I tested the change with my Pocket Deck build(1.28 preview based), but I just did smoke test on this build.
To support incremental GC for the other ports, all new allocations must be tracked.
If you use other ports other than ESP32, check ESP32 port and add write barrier to your port. Use GC_WB() macro to track the changes.
GC stack must not be overflowing to keep performance.
Changes:
- ATB is expended to 4-bit to track Tri-color GC and Data allocation type.
- MICROPY_GC_INCREMENTAL: tri-color marking driven in bounded slices from
gc_alloc().
- GC_ALLOC_FLAG_IS_DATA / m_new_data / m_renew_data: blocks known to hold no
pointers are tagged in the ATB and skipped by the marker.
- MICROPY_GC_STACK_EXTERNAL: the port supplies the mark-stack storage, so it
can live outside BSS; esp32 puts it in PSRAM.
- unix and esp32 enable incremental GC and provide the root-scan and
microsecond-clock hooks.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I recently implemented incremental garbage collection on Micropython.
This enables incremental (partial) GC running, it eliminates stop-the-world GC.
It also recognizes data allocations such as bytearray. GC will skip scan when the allocation is marked as data.
It's great for timing-critical applications such as graphic app.
I can keep 50fps on my graphic application with GC running background.
I originally made the change for my product(Pocket Deck) and I ported to recent MP build.
I know Micropython's GC is designed simple on purpose, so I don't have a plan to send any PR.
My fork is here:
https://github.com/raspy135/micropython/tree/gc-incremental
Currently only ESP32 and Unix port are supported.
I tested the change with my Pocket Deck build(1.28 preview based), but I just did smoke test on this build.
To support incremental GC for the other ports, all new allocations must be tracked.
If you use other ports other than ESP32, check ESP32 port and add write barrier to your port. Use GC_WB() macro to track the changes.
GC stack must not be overflowing to keep performance.
Changes:
All reactions