On Wed, Apr 04, 2001 at 09:23:26AM -0500, Brook A. Keele wrote:

> [...]            OpenSSL built fine, I can make the connection, most of the
> time, but after a short while I have to close the server because I am out of
> memory. These memory leaks in CRYPTO_malloc are baffling me. Anyone who can
> help, please give me some suggestions.

OpenSSL has built-in memory leak checking which will include
information on where and when the memory blocks in question have
actually been allocated.  (Your Purify output only lists CRYPTO_malloc
because this is OpenSSL's internal wrapper for malloc.)

At the beginning of the program, call CRYPTO_malloc_debug_init(),
CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL), and
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON) to enable memory leak checking.
At the end of the program, call ERR_free_strings(),
ERR_remove_state(0) and then, e.g., CRYPTO_mem_leaks_fp(stderr) to
output a list of leaks (assuming that writing to stderr is OK;
otherwise, just fopen() some other file first).

Note that some data blocks are allocated without being accounted for
by OpenSSL's memory leak debugging; this includes the data structures
used for memory leak debugging itself (for obvious reasons), but this
is just a moderate amount of memory and should not lead to 'out of
memory' failures.


[...]
>> [W] MLK: Memory leak of 20 bytes from 1 block allocated in CRYPTO_malloc
>> [W] MLK: Memory leak of 64 bytes from 1 block allocated in ssl3_accept

This last item is strange in that a function other than CRYPTO_malloc
is named as causing the leak.  Can you find out which line of ssl3_accept
is responsible for this?  Did you mention the precise version of OpenSSL
that you are using?


-- 
Bodo Möller <[EMAIL PROTECTED]>
PGP http://www.informatik.tu-darmstadt.de/TI/Mitarbeiter/moeller/0x36d2c658.html
* TU Darmstadt, Theoretische Informatik, Alexanderstr. 10, D-64283 Darmstadt
* Tel. +49-6151-16-6628, Fax +49-6151-16-6036
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to