From: "[EMAIL PROTECTED]"<[EMAIL PROTECTED]>

visiva> aa.pem is a file with 10.000 certificates.
visiva> running the following instruction
visiva> 
visiva>   STACK_OF(X509_NAME*)s=SSL_load_client_CA_file("aa.pem");
visiva> 
visiva> 10 Mb of memory are reserved to the application but
visiva> running the following instruction
visiva> 
visiva>   sk_X509_NAME_pop_free(s,X509_NAME_free);
visiva> 
visiva> the memory is not freed.
visiva> 
visiva> Any ideas ?

How did you measure that?  On which OS?  And if relevant, with which
implementation of malloc() and friends?

You see, at least on the Unixen I've played with, the heap is just
that, a heap of memory that grows upward.  The top will only decrease
if the thing you free is at the current top of the heap, otherwise, it
will just leave a hole somewhere in the middle (this hole ends up in a
free-list that makes it possible for malloc() to reuse it for new
memory allocations).

So, what happens is that if something else is allocated after you
loaded all those certs, the certs won't be the top things in the heap
anymore, and freeing them doesn't decrease the apparent use of
application memory.

This is of course OS-dependent and way outside of the scope of
OpenSSL.

If someone has a better explanatoin, please send on!

-- 
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-708-26 53 44
Procurator Odiosus Ex Infernis             -- [EMAIL PROTECTED]
           Member of the OpenSSL development team

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
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to