Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Question about storing messages in the heap of broker

On 15.04.2020 19:24, Greg Troxel wrote:
For a datapoint, I have been running mosquitto on netbsd-8 since 20
February, with moderate activity and an outgoing bridge, and it is at 23
MB process size, 4M RSS.

A similar process started since 19 February is 19MB/4M.  This one has 3
clients reporting once/minute, another 2 every 2 minutes, and weather
from a third every 5, plus incoming bridge traffic.


I wonder if you would be better off using a malloc library that has
these debugging features built in, with the normal analysis tools.
Probably, this looks like a good option, although due to H/W restrictions it will not be so easy.
My impression is that mosquitto does not have  any really bad leaks, but
there could be minor issues.  Lots of people are running it and there
aren't screams of bad memory behavior.    I don't mean to doubt your
reality; it could be not bad but observable because you are paying
attention, or only happens in your environment.  Or you could be the
first to really look.

Mosquitto I am investigating has some modifications out of the scope of main repo on GitHub. So, maybe this issue is indeed only for my environment.

Regarding minor issues: there is one thing which looks really strange. The code is following:

tokens->topic = mosquitto__strdup("");

As soon as allocation is made using wrapper, I guess that it is possible to avoid this strange code. E.g.:

const char *EMPTY_STR = "";

//-----

 void mosquitto__free(void *mem)
 {
       if(mem == NULL || mem == EMPTY_STR){
                return;
       }
//-----

temp->source_id = EMPTY_STR;

I am not sure if it is worth to be an issue on GitHub, since memory overhead is really small. =)





Back to the top