Skip to content

Commit

Permalink
examples: add gc_is_enabled() check to 2048 to prevent crash in A…
Browse files Browse the repository at this point in the history
…ndroid emulator
  • Loading branch information
larpon committed Sep 21, 2024
1 parent 5f6015f commit ba723cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/2048/2048.v
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,10 @@ fn frame(mut app App) {
if app.gg.frame % 120 == 0 {
// do GC once per 2 seconds
// eprintln('> gc_memory_use: ${gc_memory_use()}')
if gc_is_enabled() {
// Avoid assert error when built with `-gc` on some systems
gc_disable()
}
gc_enable()
gc_collect()
gc_disable()
Expand Down

0 comments on commit ba723cb

Please sign in to comment.