Merge pull request #21 from ThinkTransit/gc-threshold

gc.threshold() not available on all ports
encoder_driver
Peter Hinch 2022-11-15 08:28:12 +00:00 zatwierdzone przez GitHub
commit 5bc33d0b2a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 1 usunięć

Wyświetl plik

@ -536,7 +536,8 @@ class Screen:
while Screen.do_gc:
await asyncio.sleep_ms(500)
gc.collect()
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
if hasattr(gc, 'threshold'):
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
n += 1
n &= 0x1F
_vb and (not n) and print("Free RAM", gc.mem_free())