micropython/esp8266/modules/_boot.py
Paul Sokolovsky 0d221775f5 esp8266/_boot.py: Decrease GC alloc threshold to quarter of heap size.
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.
2016-07-23 13:56:24 +03:00

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()