After running my app for a couple of iterations for over an hour, I get the following:

[11:45:42] 10 file=stack.c, line=125, thread=15418, number=20, address=20077768 [11:45:47] 8711 file=lhash.c, line=193, thread=15418, number=12, address=20093E38 [11:45:42] 5 file=stack.c, line=125, thread=15418, number=20, address=20077508 [11:45:47] 8180 file=stack.c, line=127, thread=15418, number=16, address=20089848 [11:45:47] 8709 file=stack.c, line=125, thread=15418, number=20, address=20093B48 [11:45:42] 23 file=lhash.c, line=193, thread=15418, number=12, address=20077C78 [11:45:42] 35 file=ex_data.c, line=304, thread=15418, number=12, address=20088BE8 [11:45:42] 12 file=lhash.c, line=193, thread=15418, number=12, address=20077848 [11:45:47] 8181 file=lhash.c, line=193, thread=15418, number=12, address=200898B8 [11:45:42] 7 file=lhash.c, line=193, thread=15418, number=12, address=200775E8 [11:45:42] 36 file=stack.c, line=125, thread=15418, number=20, address=20088C58 [11:45:47] 8710 file=stack.c, line=127, thread=15418, number=16, address=20093BB8 [11:45:42] 37 file=stack.c, line=127, thread=15418, number=16, address=20088CC8 [11:45:42] 22 file=lhash.c, line=121, thread=15418, number=64, address=20077D58
thread=15418, file=err_def.c, line=346, info="int_thread_get (err.c)"
[11:45:42] 9 file=ex_data.c, line=304, thread=15418, number=12, address=200776F8 [11:45:47] 8178 file=ex_data.c, line=304, thread=15418, number=12, address=20089768 [11:45:47] 8708 file=ex_data.c, line=304, thread=15418, number=12, address=200938C8 [11:45:42] 20 file=err_def.c, line=629, thread=15418, number=396, address=200779F8 [11:45:42] 38 file=lhash.c, line=193, thread=15418, number=12, address=20088D38 [11:45:42] 4 file=ex_data.c, line=304, thread=15418, number=12, address=20077498 [11:45:42] 21 file=lhash.c, line=119, thread=15418, number=96, address=20077C98
thread=15418, file=err_def.c, line=346, info="int_thread_get (err.c)"
[11:45:47] 8179 file=stack.c, line=125, thread=15418, number=20, address=200897D8 [11:45:42] 11 file=stack.c, line=127, thread=15418, number=16, address=200777D8 [11:45:42] 6 file=stack.c, line=127, thread=15418, number=16, address=20077578
868 bytes leaked in 24 chunks

However, I get the same info over and over again (same time stamps), no matter the amount of iterations. I believe this shows that there is no continuous memory leak in SSL. The 868 bytes reported as a leak by CRYPTO_mem_leaks_fp() appears to be some initial memory
that has been allocated for the life of the application.

Thanks,
David
--------------------------------------------------
From: "Dr. Stephen Henson" <st...@openssl.org>
Sent: Monday, January 11, 2010 7:17 PM
To: <openssl-users@openssl.org>
Subject: Re: memory growing when using SSL connections

On Mon, Jan 11, 2010, David wrote:

Kevin,

Valgrind apparently is a Linux based tool, but I'm having this problem on
AIX. I actually have a simple memory leak finder that showed that SSL did
not have an obvious memory leak. It looks like most, if not all memory
management functions for SSL goes thru CRYPTO_malloc(), CRYPTO_realloc()
and CRYPTO_free() and their variants. I found a couple of calloc()s
elsewhere, but it looks like everything else got covered in these
functions.

So pretty much, when memory is allocated (or reallocated) I put it on a
linked list. When it is freed, I remove it from the list. After all my
sessions have stopped, I see that my linked list hasn't  grown from the
previous run.

I'm a bit suspicious about the realloc()s, since this is can be a source of
memory fragmentation. However, what is curious is that I don't see this
problem on Solaris.
IBM has a product called PURIFYPLUS for detecting memory leaks. Perhaps
I'll see if I can run it with the application and see if it shows up
anything.


OpenSSL has some built in leak detection. If you call something like:

MemCheck_start();

before a leaking section then:

CRYPTO_mem_leaks_fp(stderr);

after you think you've freed everything up you should get some useful results if the leak is internal to OpenSSL. The output takes a bit of getting used to
(I usually run it twice setting breakpoints) but can be very useful.

Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager majord...@openssl.org

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to