MQTT Client memory leak
Posted: Sun Jan 24, 2016 11:52 am
Hi,
I am new to nodeMCU, so this might be me
I'm seeing a memory leek in the MQTT client in NodeMCU 0.9.6 build 20150704
Here is my code, below
So it connects, and disconnects from an MQTT instance triggered by a timer.
What I see is the heap space gradually dropping until it reaches a critical level and then a reset.
The file is called "application.lua"
I run it with
It's possible I'm doing something stupid, or maybe there is a leak
Regards,
Andrew
I am new to nodeMCU, so this might be me
I'm seeing a memory leek in the MQTT client in NodeMCU 0.9.6 build 20150704
Here is my code, below
So it connects, and disconnects from an MQTT instance triggered by a timer.
What I see is the heap space gradually dropping until it reaches a critical level and then a reset.
The file is called "application.lua"
I run it with
Code: Select all
app=require("application")
app.start()
It's possible I'm doing something stupid, or maybe there is a leak
Regards,
Andrew
Code: Select all
local module = {}
local function run()
print("Heap start:" .. node.heap())
if wifi.sta.status() == 5 and wifi.sta.getip() ~= nil then
print("Connected")
m = mqtt.Client(config.ID, 120)
m:connect(config.HOST, config.PORT, 0, 1, function(con)
print("Connected")
end)
m:close()
m = nil
else
print ("Not connected")
end
print("Heap end :" .. node.heap())
end
local function test()
print("Heap start:" .. node.heap())
print("Tick ...")
print("Heap end :" .. node.heap())
end
function module.start()
tmr.stop(6)
tmr.alarm(6,1000,1, run)
end
return module