Iron BugI found where the memory leak in <strong>GnuTLS</strong> happened! I traced it for quite long time to trace it down in multithreaded calls of multiple libraries. it took some time and getting into the libraries internals.<br><br>so, the leak happens when <strong>gnutls_handshake</strong> returns an error. then the internal buffers for handshake headers are not freed properly and leak.<br>the cheap and dirty solution is to call <strong>gnutls_deinit</strong> and <strong>gnutls_init</strong> each time when a session failed a handshake (they may be numerous in long sessions).<br>this happens only when multiple threads call <strong>gnutls_handshake</strong>. on a single thread I didn't get any leaks. though, maybe there were no errors because I just had not enough traffic on the socket. though, they claim that gnutls is thread safe. so I'm not sure if everything is all right with such a use. I debug it in <strong>libmicrohttpd</strong> where I discovered the problem. <br>the internal fix for <strong>GnuTLS</strong> doesn't seem that easy. but I will to think on it. maybe the reinitialization from the outside is not that bad.<br>I will try to make a test example for showing the problem and send bug reports and possible patches to upstream. <br><a href="https://friendica.ironbug.org/search?tag=programming" rel="nofollow noopener noreferrer" target="_blank">#programming</a> <a href="https://friendica.ironbug.org/search?tag=gnutls" rel="nofollow noopener noreferrer" target="_blank">#gnutls</a> <a href="https://friendica.ironbug.org/search?tag=libmicrohttpd" rel="nofollow noopener noreferrer" target="_blank">#libmicrohttpd</a> <a href="https://friendica.ironbug.org/search?tag=memory%20leaks" rel="nofollow noopener noreferrer" target="_blank">#memory leaks</a> <a href="https://friendica.ironbug.org/search?tag=bugs" rel="nofollow noopener noreferrer" target="_blank">#bugs</a> <a href="https://friendica.ironbug.org/search?tag=hint" rel="nofollow noopener noreferrer" target="_blank">#hint</a> <a href="https://friendica.ironbug.org/search?tag=bugfix" rel="nofollow noopener noreferrer" target="_blank">#bugfix</a>