Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32: Not enough memory to load library #3610

Open
grav opened this issue Aug 2, 2023 · 1 comment
Open

ESP32: Not enough memory to load library #3610

grav opened this issue Aug 2, 2023 · 1 comment

Comments

@grav
Copy link

grav commented Aug 2, 2023

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

  1. transfer fennel.lua from here to the ESP32: https://gist.github.com/grav/d9634e6e68c44c1aa43629cefa89305a
  2. 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

@athompson673
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants