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

Reply via email to