These are chat archives for esp8266/Arduino

20th
Sep 2017
dragon-engineer
@dragon-engineer
Sep 20 2017 04:17
well, FLASH is now 40%, + OTA upgrade so it is getting a little tight. RAM is bigger problem, because now the Async web server is noticeably slower..I'll do some more testing, however the reason I updated SDK was facing memory leaks after every request the server had to handle - is anyone using Igor's Async too? Even if I only send a few bytes of text, there is memory leak 500-700 bytes. I do not use any String / malloc and the heap is getting smaller with every request until it crashes
Me No Dev
@me-no-dev
Sep 20 2017 06:52
@matasondrak first it’s my Async :D and then it does not leak ;) if it leaks, the issue would be in your code. I am open to be proven wrong though (on the leak)
oh and Igor is actually Ivan :P
dragon-engineer
@dragon-engineer
Sep 20 2017 06:53
@me-no-dev thanks for the reply :smile: and for the info
I'll test only with one handler in the entire sketch
Me No Dev
@me-no-dev
Sep 20 2017 06:55
async runs pretty low in lwip, so if an SDK update broke or introduced a change that could lead to leak, that is one possibility, but then that leak will be visible in the regular client/servers as well
dragon-engineer
@dragon-engineer
Sep 20 2017 07:00
alright, I'm at work and I forgot the nodemcu module home so I'll test later.. but the fact that sdk update increased dramatically size of the sketch is a bit disturbing
Clemens Kirchgatterer
@everslick
Sep 20 2017 14:59
@matasondrak the leaks you are seeing are probably sockets held in FIN_WAIT state. they get cleaned up after some time (minutes). the newer SDK limits the number of sockets in FIN_WAIT to something like 5 so the effect is less noticable.
dragon-engineer
@dragon-engineer
Sep 20 2017 16:29

I found out what was the cause of the leaks.. it was this NotFound handler:

server.onNotFound({
AsyncWebServerResponse *response = request->beginResponse(SPIFFS, "/404.html");
response->setCode(404);

even if it was not written correctly, this code shouldn't normally run until I request a file that is not found on the server, right? I found it strange that with this code the sketch has memory leaks, even though I only refresh page /test.html