You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I found that when there are too many Bluetooth devices around, the memory usage continues to rise after scanning is turned on.
I called "clearResults" to clean up, but it didn't work,
Then I read the code and found that "clear" is only called for "vector" in "clearResults", which doesn't actually free the memory occupied by the vector.
This is a "vector" based memory management problem.
I didn't think this would be too much of an issue since the vector would just allocate up to the peak number of devices found and not need to allocate again on the next scan. It's only around 250 bytes for 50 devices, but I will add this anyway.
If you'd like to PR the change feel free to do so.
Hello, I found that when there are too many Bluetooth devices around, the memory usage continues to rise after scanning is turned on.
I called "clearResults" to clean up, but it didn't work,
Then I read the code and found that "clear" is only called for "vector" in "clearResults", which doesn't actually free the memory occupied by the vector.
This is a "vector" based memory management problem.
esp-nimble-cpp/src/NimBLEScan.cpp
Lines 507 to 513 in a36655c
Add a line of code below "clear" to solve:
std::vector<NimBLEAdvertisedDevice *>().swap(m_scanResults.m_advertisedDevicesVector);
The text was updated successfully, but these errors were encountered: