Skip to content

Where did my RAM go? #5166

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

Closed
thezenox opened this issue May 10, 2021 · 6 comments
Closed

Where did my RAM go? #5166

thezenox opened this issue May 10, 2021 · 6 comments
Labels
Area: Performance Issue related to performance problems and improvements

Comments

@thezenox
Copy link

Hardware:

Board ESP32 Dev Module
Version/Date 2.0.0
IDE name Arduino IDE
Flash Frequency 80Mhz
PSRAM enabled yes

Description:

Using NimBLE + WiFi TLS and some bigger custom buffers with a recent update (not sure yet, which version exactly made the change) I don't have enouth heap for WiFiSecure TLS (min ~65kB) left without changing my code. With the prior Version of arduino-esp32 there was no problem.

Questions

Within the commit history, I didn't find any big changes leading to more RAM / heap usage.
Does anybody know what parts recently increased memory usage or where it is possible to free up some RAM?
Are there any new possibilities to utilize the SPIRAM for BLE, WiFi, ...?

@lbernstone
Copy link
Contributor

The OS has gotten larger as it supports more features, hardware and software.
In 2.0, memory allocations larger than 16k (4k for S2) are automatically mapped into psram. Features that will work in psram are mapped into psram. However, as arduino-esp32 is compiled to support a wide set of hardware configurations, it is not optimized for memory space. With WiFi and NimBLEDevice initialized, I have 177K of memory free (113k alloc) on an esp32-wrover.

@h2zero
Copy link
Contributor

h2zero commented May 12, 2021

@thezenox If you're using NimBLE as stated and have PSRAM, you can move the NimBLE core to PSRAM by setting
CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL 1 in the nimconfig.h file, or using the option in menucofig if using IDF.
That should reduce the RAM by about 10k from the internal heap, YMMV.

@VojtechBartoska VojtechBartoska added the Area: Performance Issue related to performance problems and improvements label May 18, 2021
@VojtechBartoska
Copy link
Contributor

@thezenox Can I consider your question covered and solved?

@thezenox
Copy link
Author

kind of, yes. Setting CONFIG_BT_NIMBLE_MEM_ALLOC_MODE_EXTERNAL saved me enougth for getting my application working again. Thanks

@SaitamaTechno
Copy link

SaitamaTechno commented Apr 9, 2023

Hey guys, I am using esp32 cam module with micropython firmware. When I capture photos as many as 20 or 30 kb of size, it runs out of ram and the board resets itself. People say it has 500kb of sram but I cannot use it. The similar issue happened when I used esp8266. This time, when I create lists as large as 30kb, it runs out of ram and resets itself. Do you have any suggestion?

@me-no-dev
Copy link
Member

@SaitamaTechno this is the Arduino issue tracker, not the micropython one :) Here camera works fine with much larger images.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Performance Issue related to performance problems and improvements
Projects
None yet
Development

No branches or pull requests

6 participants