From: "Richard Dykiel" <[EMAIL PROTECTED]>
Subject: thread support and Memory leaks
Date: Mon, 5 Jun 2000 17:02:15 -0400
Message-ID: <000901bfcf31$53a0fdb0$[EMAIL PROTECTED]>

richard.dykiel> Hello,
richard.dykiel> sorry, mem leaks again.
richard.dykiel> 
richard.dykiel> On SunOs 5.6, openssl 0.9.5a :
richard.dykiel> 
richard.dykiel> In a multithreaded context, I have memory leaks reported when my 
application is compiled with CRYPTO_MDEBUG_ALL (see attached file). I have 3 questions 
on this:
richard.dykiel> 
richard.dykiel> 1- am I not chasing leaks coming from the debug memory
richard.dykiel> functions?

Hopefully not :-).  Seriously, there's been soem work done chasing
memory leaks, and some have actually been found, but for the most
part, it looks like OpenSSL is pretty clean if handled right (as in,
if you got memory allocated when calling some function, you'd better
do something to free it as well).  So, there's some likelyhood that
your application is leaking a bit.

If you wanna do further traces of the calling paths that lead to those
leaks, take a look at CRYPTO_push_info and CRYPTO_pop_info (in
crypto.h).

richard.dykiel> 2- thread support: do we have to explicitly call
richard.dykiel> CRYPTO_set_locking_callback and CRYPTO_set_id_callback
richard.dykiel> in a multithreaded context? It is said so in the
richard.dykiel> "threads" manpage, but they seem to be used only in
richard.dykiel> test programs (mttest.c, th-lock.c)

Yes, your application must use those two calls to set up threading
callbacks, ro you can say bye-bye to thread locking and thread
identification.  The latter is used in some data structures to keep
track of what thread "owns" what part of it.  If that one is not
given, the threads will truly share those structures and the data
within them completely, and you will probably end up with a pretty
trashed application on some points.

richard.dykiel> 3-  I am calling   ERR_remove_state(0) at the end of
richard.dykiel> each thread; any other cleanup function to call?

I think that should be enough, but don't take my word on it.

-- 
Richard Levitte   \ Spannvägen 38, II \ [EMAIL PROTECTED]
Chairman@Stacken   \ S-168 35  BROMMA  \ T: +46-8-26 52 47
Redakteur@Stacken   \      SWEDEN       \ or +46-709-50 36 10
Procurator Odiosus Ex Infernis             -- [EMAIL PROTECTED]
Member of the OpenSSL development team: http://www.openssl.org/
Software Engineer, Celo Communications: http://www.celocom.com/

Unsolicited commercial email is subject to an archival fee of $400.
See <http://www.stacken.kth.se/~levitte/mail/> for more info.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to