NVS memory leak - nvs_pagemanager using too much memory
Posted: Wed Aug 02, 2017 6:41 am
So, this is not a real memory leak but it will use too much memory for my app to run. When my app is fully functional, it has BLE running and aws mqtt connection. At this point, I have about 70KB of free heap available. But if I continue to read/write into NVS, I will loose lot of memory to a point where my app will crash.
If my NVS partition is very small like 24KB, this is NOT a problem. But if my NVS is large like 2MB, this becomes a real problem. In the NVS code, I think data structures inside "nvs_pagemanager.cpp" is growing as I repeat read/write into NVS.
Here is the code that will reproduce this problem:
https://drive.google.com/open?id=0B8IOF ... 2ttWmdBR1U
After downloading you can build with these commands to reproduce leak case and no leak case.
Again, this is NOT really a leak, but it just uses too much memory.
To reproduce LEAK case:
To reproduce NO LEAK case:
Is it possible to add some kind of nvs_flush() function I can call so it clears the nvs_pagemanager after I am done writing to NVS?
If my NVS partition is very small like 24KB, this is NOT a problem. But if my NVS is large like 2MB, this becomes a real problem. In the NVS code, I think data structures inside "nvs_pagemanager.cpp" is growing as I repeat read/write into NVS.
Here is the code that will reproduce this problem:
https://drive.google.com/open?id=0B8IOF ... 2ttWmdBR1U
After downloading you can build with these commands to reproduce leak case and no leak case.
Again, this is NOT really a leak, but it just uses too much memory.
To reproduce LEAK case:
Code: Select all
make defconfig SDKCONFIG_DEFAULTS=sdkconfig.leak.defaults
make
make erase_flash flash
Code: Select all
make defconfig SDKCONFIG_DEFAULTS=sdkconfig.noleak.defaults
make
make erase_flash flash