ESP32: Not enough memory to load library
grav opened this issue · 1 comments
I'm trying to load a library (the Fennel compiler) into the ESP32.
The file is ~230k so it may simply be too big, but it might also be that there's an artificial limitation on memory, because NodeMCU was originally meant for the ESP8266?
Here's what Lua reports on my device:
print(node.heap())
>> 210688
I did find indications that the mem-limit can be set, but I'm not sure exactly how to build NodeMCU with a different mem-limit.
Expected behavior
Library loads
Actual behavior
Error: Not enough memory
Test code
- transfer
fennel.lua
from here to the ESP32: https://gist.github.com/grav/d9634e6e68c44c1aa43629cefa89305a - execute the following code on the ESP32:
return loadfile('fennel.lua')
The device will return
>> nil not enough memory
NodeMCU startup banner
NodeMCU ESP32 build unspecified powered by Lua 5.1.4 [5.1-doublefp] on IDF v4.4.3
Hardware
ESP-WROOM-32
210kByte is far more availaible heap than on the 8266 (which generally has at most ~44k after boot), so it's likely the true amount of heap available to load code into. The LFS feature is intended to remove the requirement to execute code out of RAM, which may be your only option for such a large file.