-
Notifications
You must be signed in to change notification settings - Fork 1.3k
rgbmatrix: decrease RAM usage over soft resets #3499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@jepler Do we need to fix this for 6.0.0? |
No. |
@cwalther was this addressed by the enhancements to supervisor allocations or does it still need to be done? |
As far as I understand it is addressed. Looking at a4b84cf, the previous implementation would allocate preferentially on the GC heap, while the new one should reuse previously freed supervisor allocations when possible. Empirical result: In a quick test I’m seeing considerably less GC memory use after initializing an RGBMatrix display for the second time after a soft reset, so it seems to be effective. Before:
After:
rgbmat_display.py: import displayio
import framebufferio
import rgbmatrix
import gc
import microcontroller.pin as pin
gc.collect();
a, f = gc.mem_alloc(), gc.mem_free()
print(a+f, a, f)
#displayio.release_displays()
rgbm = rgbmatrix.RGBMatrix(width=32, bit_depth=6, rgb_pins=[pin.PB02, pin.PB03, pin.PB08, pin.PB09, pin.PB10, pin.PB11], addr_pins=[pin.PA20, pin.PA21, pin.PA22, pin.PA23], clock_pin=pin.PB22, latch_pin=pin.PB23, output_enable_pin=pin.PA27)
display = framebufferio.FramebufferDisplay(rgbm, auto_refresh=True)
gc.collect()
a, f = gc.mem_alloc(), gc.mem_free()
print(a+f, a, f) |
excellent, thank you again |
.. implement #3498 but for rgbmatrix. will require the same infrastructure commits to be merged in first.
The text was updated successfully, but these errors were encountered: