-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leaks detected by valgrind #1518
Comments
… MQTTPacket_publish() As seen in eclipse-paho#1518 the memory allocated for pack-topic were not released in all cases. Signed-off-by: Juergen Kosel <[email protected]>
Do you have a scenario or test program to produce this? Does it still exist, or is it any different in the latest release 1.3.13 or the develop branch? |
Unfortunately I have only my application and its tests, which I can not provide. Does it still exist, or is it any different in the latest release 1.3.13 or the develop branch? The issue still exists on the develop branch. (I reproduced with the single commit of #1487, which is based on the develop branch. Correct? |
…refore unprocessed pack type Unprocessed pack lead to memory leak, as in eclipse-paho#1518 Signed-off-by: Juergen Kosel <[email protected]>
…refore unprocessed pack type Unprocessed pack lead to memory leak, as in eclipse-paho#1518 Signed-off-by: Juergen Kosel <[email protected]>
Can you give me a sense of the activity and scale of your application? How many MQTT client objects, subscribe/publish activity, network interruptions, that sort of thing? How long does it run to produce this situation? Perhaps a library trace at the protocol level? The memory allocated in processPublication is normally freed in messageArrived by calling MQTTAsync_free and MQTTAsync_freeMessage normally. I've tried several tests of various kinds but not had any problem so far. This is with the latest develop branch. |
I'm sceptical that #1487 has any bearing on this. The only way that could be invoked would be a protocol error, and I will close that loophole. I don't think what you're seeing is a result of a protocol error on the part of the server. |
Hello, I just found out, that my colleague has not read the documentation properly: /**
* This function frees memory allocated to an MQTT message, including the
* additional memory allocated to the message payload. The client application
* calls this function when the message has been fully processed. <b>Important
* note:</b> This function does not free the memory allocated to a message
* topic string. It is the responsibility of the client application to free
* this memory using the MQTTAsync_free() library function.
* @param msg The address of a pointer to the ::MQTTAsync_message structure
* to be freed.
*/
LIBMQTT_API void MQTTAsync_freeMessage(MQTTAsync_message** msg); So the functions |
Hi Jürgen. A useful place to see example code is to look at the samples, paho_c_sub and paho_c_pub - they contain all the basic structure and usage. |
Describe the bug
As mentioned in #1487 (comment)
I had integrated the paho.mqtt.c of pull request #1487 to verify if this fixes a memory-leaks which was detected by
valgrind
in my application.Unfortunally the memory leak still perists.
valgrind
reported the following memory-leaks:To Reproduce
My application uses MQTT publish and subscribe.
Expected behavior
When the application terminates, all memory allocated by paho.mqtt.c is either released or the paho.mqtt.c libary holds still a pointer to that memory.
Environment:
The text was updated successfully, but these errors were encountered: