fix(ui): collect after a rebuild so the heap is in a known state
A build allocates a spec table per node and drops them all at once, so an app that scans WiFi right after a screen change met whatever the incremental GC had got around to. Costs a few ms on a screen change; recovers ~24 KB.
This commit is contained in:
@@ -386,6 +386,11 @@ function ui.rebuild()
|
|||||||
laidOut = true
|
laidOut = true
|
||||||
gui.clear(ui.theme.background)
|
gui.clear(ui.theme.background)
|
||||||
node.draw(root)
|
node.draw(root)
|
||||||
|
-- A build allocates a spec table per node and drops them all here, and the next thing an
|
||||||
|
-- app does may be the one that needs a contiguous WiFi buffer. Collecting now costs a few
|
||||||
|
-- milliseconds on a screen change nobody can see, and leaves the heap in a known state
|
||||||
|
-- instead of one that depends on when the incremental GC last ran.
|
||||||
|
collectgarbage()
|
||||||
end
|
end
|
||||||
|
|
||||||
function ui.draw()
|
function ui.draw()
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user