* Marvin Humphrey shaped the electrons to say...
I think you'll need to look elsewhere. Coincidentally, I'm debugging memory leaks right this moment using valgrind. If you have access to a Linux system, I'd strongly recommend you give it a try.
Any suggestions for using valgrind with Perl/XS? I'm debugging a memory leak right now too: long bio_write_cb(struct bio_st *bm, int m, const char *ptr, int l, long x, long y) { if (m == BIO_CB_WRITE) { SV *sv = (SV *) BIO_get_callback_arg(bm); sv_catpvn(sv, ptr, l); } if (m == BIO_CB_PUTS) { SV *sv = (SV *) BIO_get_callback_arg(bm); l = strlen(ptr); sv_catpvn(sv, ptr, l); } return l; } static BIO* sv_bio_create(void) { SV *sv = newSVpvn("", 0); /* create an in-memory BIO abstraction and callbacks */ BIO *bio = BIO_new(BIO_s_mem()); BIO_set_callback(bio, bio_write_cb); BIO_set_callback_arg(bio, (void *)sv); return bio; } static SV* sv_bio_final(BIO *bio) { SV* sv; BIO_flush(bio); sv = (SV *)BIO_get_callback_arg(bio); BIO_free_all(bio); if (!sv) { sv = &PL_sv_undef; } return sv; } MODULE = Crypt::OpenSSL::X509 PACKAGE = Crypt::OpenSSL::X509 PROTOTYPES: DISABLE .... snip .... SV* pubkey(x509) Crypt::OpenSSL::X509 x509; PREINIT: EVP_PKEY *pkey; BIO *bio; CODE: pkey = X509_get_pubkey(x509); bio = sv_bio_create(); if (pkey == NULL) { BIO_free_all(bio); EVP_PKEY_free(pkey); croak("Public Key is unavailable\n"); } if (pkey->type == EVP_PKEY_RSA) { PEM_write_bio_RSAPublicKey(bio, pkey->pkey.rsa); } else if (pkey->type == EVP_PKEY_DSA) { PEM_write_bio_DSA_PUBKEY(bio, pkey->pkey.dsa); } else { BIO_free_all(bio); EVP_PKEY_free(pkey); croak("Wrong Algorithm type\n"); } EVP_PKEY_free(pkey); RETVAL = sv_bio_final(bio); OUTPUT: RETVAL Repeated calls to $x509->pubkey cause a noticiable memory leak. -D -- Adobe Photoshop - When you want the truth. Real bad.