0

Can anybody tell me why my Lua code is running out of memory. It successfully sets up the wifi connection. However, it runs out of heap memory before I connect the first client.

This is why this is imho NOT A DUP of ESP8266 NodeMCU Running Out of Heap Memory

wifi.setmode(wifi.STATION)
station_cfg={}
station_cfg.ssid="WLAN-xxxx"
station_cfg.pwd="xxxxxxx"
wifi.sta.config(station_cfg)
wifi.sta.connect()

print(wifi.sta.getip())
RELAIS = 5
LED=0

gpio.mode(RELAIS, gpio.OUTPUT)
srv=net.createServer(net.TCP)
print(node.heap())
srv:listen(80,function(conn)
    conn:on("receive", function(client,request)
        print(node.heap())
--[[   ... some more stuff not relevant for the bug ...

   ]]
        client:close();
        collectgarbage();
    end)
end)
print(node.heap())

The output for the first heap call is 38984. There is no output for the second heap.

CAFEBABE
  • 3,983
  • 1
  • 19
  • 38

0 Answers0