0d221775f5
The idea behind decrease is: bytecode and other static data is also kept on heap, and can easily become half of heap, then setting threshold to half of heap will have null effect - GC will happen on complete heap exhaustion like before. But exactly in such config maintaining heap defragmented is very important, so lower threshold to accommodate that.
14 lines
231 B
Python
14 lines
231 B
Python
import gc
|
|
gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4)
|
|
import uos
|
|
from flashbdev import bdev
|
|
|
|
try:
|
|
if bdev:
|
|
vfs = uos.VfsFat(bdev, "")
|
|
except OSError:
|
|
import inisetup
|
|
vfs = inisetup.setup()
|
|
|
|
gc.collect()
|