On Mon, Nov 13, 2000 at 04:22:29PM +0530, Shridhar Bhat wrote:

>>> I have written a server which receives connections from
>>> SSL clients. I accept SSL connections as well as read the
>>> data from the client in the following function: DoSSLRead.
>>> Upon the arrival of the client connection, the SSL_read()
>>> is called 3 times (2 times for handshake data and once
>>> for client app data). When I monitor this process through
>>> top, I see that the process footprint increases by 8kb
>>> each for first two calls of SSL_read. In the last SSL_read
>>> call, when I read app data, there is no leak. Thus, for
>>> every client connection, my process seems to leak 16kb.

>> Sure that those are memory _leaks_?  If the SSL objects are created
>> from the same SSL_CTX, then the SSL_CTX will contain a session cache,
>> which will expand as new sessions are added.

> First, I too thought it's the session cache. But even one single
> connection
> served grew the memory footprint by 20KB. Later on I read that top is
> broken for ELF programs. May be top is giving me problems.
> 
> I am creating a pool of 50 SSL structures out of a SSL_CTX and reusing
> it.
[...]
> Without serving any client connections, the dump shows 87774 bytes of
> leak in all the above files.

You said you don't observe those leaks on NT -- are you doing
anything differently in the setup code, such as use SSL_CTX_use_certificate
in one case and SSL_CTX_use_certificate_file in the other case?
The memory leak ist that you appended did include some X.509 stuff.

Since your memory leaks are visible to the OpenSSL memory debugging
functions, you should be able to can track them down by using
CRYPTO_push_info("some string") and CRYPTO_pop_info().
OpenSSL keeps an internal stack of strings that will be included in
the memory debugging output, so you can individually mark each of the
functions that you call in your initialisation and other code to see
which one allocated the memory that is not freed when your program
finishes.


-- 
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