9 years, 10 months ago.

hello sir, this mqtt publisher fails after 110 publishes. can you explain why?

hello sir, this mqtt publisher fails after 110 publishes. can you explain why?

Question relating to:

This is the first stage and sends data (temp, humidity) to mqtt server. client, MQTT

1 Answer

9 years, 10 months ago.

If it fails after 110 every time, or around 110 it sound like a memory leak.

Just had a quick look at main.cpp

            char * value = new char [37];
            strcpy(value, data.c_str());
            mqtt.publish(pub_topic, value);

If you ever see a new without a delete in c++ it's a bad sign. I don't know how this library works but this probably isn't right.

Accepted Answer