As a general comment not all memory leaks reported by these tools are
a bad thing. I often write code that has these type of leaks on
purpose for performance reasons. For example a function that is
called often and malloc's memory ... rather than malloc and free each
time (causing context switching and generally slow) I just make the
pointer static and a size variable static. I use the pointer until
it is too small, then I realloc to a larger size. In modern systems
often the "leak" is worth the performance gain. I run on IBM
AIX. Having said that, I have not dug in to your specifics which may
just be bugs, an error with the tool, or deliberate. Eric
At 11:58 AM 6/24/2011, Yan, Bob wrote:
Hi,
I have used IBM purify to check my test program which invokes
openssl library. There are some memory leaks reported by Purify,
please see below. Could somebody point to me from which function
those leaks were generated, and how to avoid those leaks? Thanks, Bob
MLK: 1104 bytes leaked in 46 blocks
This memory was allocated from:
malloc [rtlib.o]
CRYPTO_malloc [libcrypto.so.1.0.0]
ASN1_STRING_type_new [libcrypto.so.1.0.0]
ASN1_primitive_new [libcrypto.so.1.0.0]
asn1_item_ex_combine_new [libcrypto.so.1.0.0]
asn1_item_ex_combine_new [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
asn1_template_noexp_d2i [libcrypto.so.1.0.0]
Block of 24 bytes (46 times); last block at 0x2aaaac0f7218
MLK: 836 bytes leaked in 2 blocks
This memory was allocated from:
malloc [rtlib.o]
CRYPTO_malloc [libcrypto.so.1.0.0]
asn1_enc_save [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
asn1_template_noexp_d2i [libcrypto.so.1.0.0]
asn1_template_ex_d2i [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
ASN1_item_d2i [libcrypto.so.1.0.0]
Block of 432 bytes at 0x2aaaac093668
Block of 404 bytes at 0x2aaaac009d58
MLK: 800 bytes leaked in 20 blocks
This memory was allocated from:
malloc [rtlib.o]
CRYPTO_malloc [libcrypto.so.1.0.0]
ASN1_OBJECT_new [libcrypto.so.1.0.0]
c2i_ASN1_OBJECT [libcrypto.so.1.0.0]
asn1_ex_c2i [libcrypto.so.1.0.0]
asn1_d2i_ex_primitive [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
asn1_template_noexp_d2i [libcrypto.so.1.0.0]
Block of 40 bytes (20 times); last block at 0x2aaaac097a78
MLK: 600 bytes leaked in 15 blocks
This memory was allocated from:
malloc [rtlib.o]
CRYPTO_malloc [libcrypto.so.1.0.0]
asn1_item_ex_combine_new [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
asn1_template_noexp_d2i [libcrypto.so.1.0.0]
asn1_template_ex_d2i [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
asn1_template_noexp_d2i [libcrypto.so.1.0.0]
Block of 40 bytes (15 times); last block at 0x2aaaac0f6e98
MLK: 376 bytes leaked in 33 blocks
This memory was allocated from:
malloc [rtlib.o]
CRYPTO_malloc [libcrypto.so.1.0.0]
ASN1_STRING_set [libcrypto.so.1.0.0]
asn1_ex_c2i [libcrypto.so.1.0.0]
asn1_d2i_ex_primitive [libcrypto.so.1.0.0]
ASN1_item_ex_d2i [libcrypto.so.1.0.0]
asn1_template_noexp_d2i [libcrypto.so.1.0.0]
asn1_template_ex_d2i [libcrypto.so.1.0.0]
Block of 14 bytes (21 times); last block at 0x2aaaac0f7168
Block of 12 bytes (2 times); last block at 0x2aaaac096828
Block of 11 bytes (2 times); last block at 0x2aaaac096338
Block of 5 bytes (6 times); last block at 0x2aaaac0976f8
Block of 3 bytes (2 times); last block at 0x2aaaac095e58
.
.
.
Eric S. Eberhard
(928) 567-3727 Voice
(928) 567-6122 Fax
(928) 301-7537 Cell
Vertical Integrated Computer Systems, LLC
Metropolis Support, LLC
For Metropolis support and VICS MBA Support!!!! http://www.vicsmba.com
Pictures of Snake in Spring
http://www.facebook.com/album.php?aid=115547&id=1409661701&l=1c375e1f49
Pictures of Camp Verde
http://www.facebook.com/album.php?aid=12771&id=1409661701&l=fc0e0a2bcf
Pictures of Land Cruiser in Sedona
http://www.facebook.com/album.php?aid=50953&id=1409661701
Pictures of Flagstaff area near our cabin
http://www.facebook.com/album.php?aid=12750&id=1409661701
Pictures of Cheryl in a Horse Show
http://www.facebook.com/album.php?aid=32484&id=1409661701
Pictures of the AZ Desert
http://www.facebook.com/album.php?aid=58827&id=1409661701
(You can see why we love this state :-) )
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majord...@openssl.org