kopia lustrzana https://github.com/peterhinch/micropython-micro-gui
ugui.py: Enable user to disable GC.
rodzic
d2a9cf037f
commit
08a8ef3b09
10
README.md
10
README.md
|
@ -891,10 +891,12 @@ explicitly in code.
|
||||||
|
|
||||||
## 4.5 Bound variable
|
## 4.5 Bound variable
|
||||||
|
|
||||||
* `pause_ms=0` Screen refreshes are performed by a looping task. This
|
* `do_gc = True` By default a coroutine is launched to periodically perform
|
||||||
refreshes the screen before pausing. The default of 0ms allows other tasks to
|
garbage collection (GC). On most platforms this reduces latency by doing GC
|
||||||
be scheduled and suffices in the vast majority of cases. In some applications
|
before too much garbage has accumulated. However on platforms with SPIRAM GC
|
||||||
with difficult realtime requirements a longer pause can offer benefits.
|
can take hundreds of ms, causing unacceptable latency. If `do_gc` is `False`
|
||||||
|
the application can perform GC at times when fast response to user actions is
|
||||||
|
not required.
|
||||||
|
|
||||||
## 4.6 Usage
|
## 4.6 Usage
|
||||||
|
|
||||||
|
|
|
@ -505,7 +505,7 @@ class Screen:
|
||||||
|
|
||||||
async def _garbage_collect(self):
|
async def _garbage_collect(self):
|
||||||
n = 0
|
n = 0
|
||||||
while True:
|
while Screen.do_gc:
|
||||||
await asyncio.sleep_ms(500)
|
await asyncio.sleep_ms(500)
|
||||||
gc.collect()
|
gc.collect()
|
||||||
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
|
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
|
||||||
|
|
Ładowanie…
Reference in New Issue