mirror of
https://github.com/vlang/v.git
synced 2025-09-10 07:47:20 -04:00
examples: add gc_is_enabled()
check to 2048
to prevent crash in Android emulator (#22274)
This commit is contained in:
parent
33073407c6
commit
1e1bc1046a
@ -882,6 +882,10 @@ fn frame(mut app App) {
|
|||||||
if app.gg.frame % 120 == 0 {
|
if app.gg.frame % 120 == 0 {
|
||||||
// do GC once per 2 seconds
|
// do GC once per 2 seconds
|
||||||
// eprintln('> gc_memory_use: ${gc_memory_use()}')
|
// 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_enable()
|
||||||
gc_collect()
|
gc_collect()
|
||||||
gc_disable()
|
gc_disable()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user