Closed JEG8 closed 9 months ago
is it not some glitch in the code for the free memory calculation?
No, it is directly from MemoryFree library. https://github.com/mpflaga/Arduino-MemoryFree/blob/master/MemoryFree.cpp
I used that too so I know it is OK. Once I had some other and it didn't work good.
Is the buff string terminated by 0?
Yes, the buff string is being formulated using the code below. snprintf properly adds the null terminator to the string. I printed out the hex contents and did in fact see that the null terminator.
char buff[32];
snprintf(buff, sizeof(buff), PATH);
Also, if I comment out the client.get() call, the memory usage does not drop. It doesn't seem like its in the formation of the object, but instead the .get() call itself.
The WiFiNINA library allocates 1500 bytes for buffers at once, but only once.
Great find! Thank you, this explains what I am seeing.
Do you know of any way I can save memory with this implementation?
you can change the WIFI_SOCKET_BUFFER_SIZE at the beginning of WiFiSocketBuffer.cpp
Thank you for your help! I will mark this issue as closed.
Hi,
I am facing an issue with the library (in conjunction with and ) via your OTASketchDownloadWifi example, where I make a very simple call of client.get(buff), where buff is defined as the path for my server. My freeMemory (between heap and stack) drops by 1.5K when this call happens. I am assuming the memory is being claimed by something in the ArduinoHttpClient library. When I call client.stop(), the memory is not released. This makes it very difficult to use in a system where memory is critical.
Is there any reason why this would happen? Is there a recommended method to prevent this drop or does your library provide a way to fix this?
Thanks for any help in advance.