ESP32: no default gc threshold
Latest stable firmware (esp32-20180511-v1.9.4.bin) does not appear to have a garbage collection threshold. running gc.threshold() in the REPL returns -1. gc.isenabled() returns True. Running in a loop will take the free heap space to zero, with no automatic gc.
Is there a reason for this default configuration? The esp8266 has an out-of-the-box gc threshold of 8992.
esp8266 : available heap: DRAM ?
Reading this doc
https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
there is a region of memory, called DRAM:
User data RAM. Available to applications.
It is 80 KB.
Does the micropython firmware use it?
If not, is it possible to merge this region the the heap?
MicroPython v1.20.0 on 2023-04-26; ESP module with ESP8266
At startup I have about 35 KB of free heap, running only this boot.py
from micropython import alloc_emergency_exception_buf
alloc_emergency_exception_buf(100) # give traceback info when RAM allocation would fail
import gc
gc.enable()
#gc.threshold((gc.mem_free() + gc.mem_alloc()) // 4)
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
import esp
esp.osdebug(None)
esp.sleep_type(esp.SLEEP_NONE)
from machine import freq
freq(160000000) # CPU at 160 MHz
try :
from sys import tracebacklimit
tracebacklimit(10)
except :
pass
#import uos
# detach REPL UART (GPIO1, 3; disable print, also via USB)
#uos.dupterm(None, 1) # disable REPL on UART(0)
gc.collect()
print("boot.py", gc.mem_free())