wifi.setmode(wifi.STATIONAP)
srv=net.createServer(net.TCP)
x=1
srv:listen(80,function(conn)
conn:on("receive", function(client,request)
local a,b,c=node.info()
client:send("HTTP/1.1 200 OK\r\nContent-type: text/html\r\nConnection: close\r\n\r\n<!DOCTYPE html><head></head><body><p>Iterations: "..x.." Heap: "..node.heap().."</p><p>Version: "..a.."."..b.."."..c.."</p><script>setTimeout('location.reload();',300);</script></body></html>")
x=x+1
end)
conn:on("sent", function() WiFiclose() end)
function WiFiclose() conn:close() collectgarbage() print(node.heap()) end
end)
Run this on your ESP device and enter the IP address into your browser (it doesn't care what file you are accessing). You will see that 0.9.6 starts at around 27K and stabilizes at around 24K. In my case, 2.0.0 starts at around 37K and decreases at a rate of about 200 bytes per iteration until it crashes at around 3K. I noticed that if I increase the delay before reload to about a second, 2.0.0 will stabilize at around 4K and not crash. This implies that the garbage collection is not aggressive enough. I haven't tried this on any other versions, since I don't have a build environment. Perhaps this can be as simple as upping the garbage collection priority.