[Help-gnutls] Re: memory leak in gnutls in multithreaded program??

Simon Josefsson jas at extundo.com
Fri Feb 10 16:04:24 CET 2006

Ang Way Chuang <wcang at yahoo.com> writes:

> Hi all,
>    I wrote a sample server program using gnutls 1.2.9. I did gcry_control
> (GCRYCTL_SET_THREAD_CBS ...) stuff mentioned in the manual. Yet whenever I
> create a new thread to service a new session from client, the memory allocation
> for the server process increases for every new thread created. I saw this
> behaviour through top.However, when the thread exits, the memory wasn't freed.
> I run the program under valgrind and there is no memory leak reported. Do I
> need to do anything special in the thread apart from gnutls_bye, shutdown,
> close & gnutls_deinit to get the memory freed? Please advise. Thanks

Hi.  You'll need to deallocate all other stuff that may have been
allocated in that particular thread (like certificates), of course,
but other than that.

If valgrind doesn't indicate a memory leak, I would guess that the
threading sub-system simply steals that memory from you.

Sorry that this is little help.  Perhaps others have more ideas.


More information about the Gnutls-help mailing list