-
Notifications
You must be signed in to change notification settings - Fork 42
Description
I have a simple MqttBroker setup, listening on a socket. I have been doing some testing that requires repeated connection opening/closing and I'm getting weird behavior. I added some more debugging and found there appears to be a memory leak related to TinyMqtt.
To reproduce this I am doing the following:
$ while true
do
mosquitto_pub -h <my_esp> -p 1883 -t foobar -m '{}'
done
I then have my esp periodically dumping memory stats. Effectively:
// every second
Serial.print("free_heap=");
Serial.println(xPortGetFreeHeapSize());
With that, I'm seeing every time I connect I have less memory available.
EDIT: I had some thoughts below on what was causing this, but I now found I was incorrect. I'm still seeing the memory leak, but I'm not clear what's causing it.
My guess is it's not as simple as the clients
list not getting purged (I think I understand how that's happening now), but that the MqttClient itself isn't getting cleaned up.