-
Notifications
You must be signed in to change notification settings - Fork 7.6k
BLEServer Memory Leak after device connecting and disconnecting #10130
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
Comments
The Platformio setup is not good, since it maybe does not use the corresponding Arduino libs how the setup is made.
|
My original observation was done using idf toolchain v4.4 and latest arduino lib for that version, not platformio. |
Sorry, thanks for informing me, I updated the platformio.ini like so:
But the issue still persists:
Sorry, I have edited the post to reflect this. |
I have found this issue on the idf repository which from a surface level understanding looks similar to this one here. From what I gathered, the problem there was caused by something in the build environment. I will try to uninstall and reinstall platformio as well as test it on another computer to see if the issue persists. Edit: I have built the example project on ESP-IDF v5.2.1 and found that the heap memory stopped decreasing after 14 disconnects and reconnects. So I suppose this an Issue with the IDF and not arduino-esp32 and therefore can be closed, but I wanted to know if this also happens to others running arduino-esp32 or if it is specific to my environment, I will build and test this on another computer later. |
@victorfleischauer - I tested it using IDF 5.1.4 with Arduino Core 3.0.4 (Arduino IDE Building system).
|
I think that the process is a bit dynamic as it has many tasks being executed along time. Let me know if you agree and we could close this issue. |
Uhh, memory dropping without being reclaimed is a definition of memory
leak. I also tried nimble which doesn't exhibit this behavior.
…On Thu, Aug 8, 2024 at 5:26 PM Rodrigo Garcia ***@***.***> wrote:
I think that the process is a bit dynamic as it has many tasks being
executed along time.
But it seems that there is no memory leak.
Let me know if you agree and we could close this issue.
—
Reply to this email directly, view it on GitHub
<#10130 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPBUE6EVCMNW2OBT5WDEE3ZQQEDJAVCNFSM6AAAAABME7V2QOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZWHEZTQNZRG4>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
The current BLE layer uses Arduino String and some other little parts that allocate small chunks of memory. I think that this behavior may be a mix with fragmentation problems as well, rather than exclusively a memory leak. The current BLE library is subject to a future refactoring that will be based on NimBLE. |
Thanks @SuGlider, interesting to hear that the Arduino BLE library is planed to use NimBLE, I noticed the NimBLE-Arduino library does not have this behavior. I will close this issue then. |
Board
ESP32-S3-DevKitC-1
Device Description
ESP32-S3-DevKitC-1 v1.0
Hardware Configuration
No connections.
Version
v3.0.4
IDE Name
PlatformIO
Operating System
macOS 14.5
Flash frequency
40Mhz
PSRAM enabled
no
Upload speed
460800
Description
When acting as a BLEServer, after every connection and disconnection the heap memory appears to shrink by
around 412 bytes (except the first connection, which loses around 1 kilobyte)
This appears to be a memory leak.
Sketch
Debug Message
Other Steps to Reproduce
platformio.ini
I have tested this by connecting and disconnecting to the ESP32-S3 using the nRF Connect Android app.
The sketch provided is a modified version of the BLE Notify example.
This bug appears to be the same as the one found by @mirozmrzli in this discussionEdit: The problem found by @mirozmrzli may be unrelated, as he was using idf toolchain v4.4 and latest arduino lib
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: