examples: add gc_is_enabled() check to 2048 to prevent crash in Android emulator (#22274)

This commit is contained in:
larpon 2024-09-22 06:41:26 +02:00 committed by GitHub
parent 33073407c6
commit 1e1bc1046a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 `-cg` on some systems
gc_disable()
}
gc_enable()
gc_collect()
gc_disable()