-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
Hi Shlomi I just noticed that, if i merge yenc_encode_c_for_perl with _yenc_encode_c into one function then valgrind stops reporting memory leaks. I need to do more tests though. Thanks and best regards, David Santiago On Thu, 1 Oct 2015 22:16:58 +0200 David Emanuel da Costa Santiago <deman...@gmail.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > > > Hi Shlomi, > > Thanks for your reply. I tried your suggestion and it didn't work: > > ==10175== LEAK SUMMARY: > ==10175== definitely lost: 24,451 bytes in 37 blocks > ==10175== indirectly lost: 76,082 bytes in 33 blocks > ==10175== possibly lost: 14,587,533 bytes in 52,651 blocks > ==10175== still reachable: 111,892 bytes in 2,953 blocks > ==10175== suppressed: 0 bytes in 0 blocks > > > > What do you mean with "mortal" ? If you mean a temporary value then > it's yes. > > Regards, > David Santiago > > > > On Thu, 1 Oct 2015 21:26:59 +0300 > Shlomi Fish <shlo...@shlomifish.org> wrote: > > > On Thu, 1 Oct 2015 19:51:12 +0200 > > David Emanuel da Costa Santiago <deman...@gmail.com> wrote: > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > > Hash: SHA256 > > > > > > > > > Now with the code attached. > > > > > > Best regards, > > > David Santiago > > > > > > > Hi David! > > > > One thing that strikes me as a problem is the fact that > > _yenc_encode_c returns a string that was malloc()ed/realloc()ed and > > I don't think that Inline::C will free() it for you. What you should > > try to do is: > > > > char* _yenc_encode_c(unsigned char* data, size_t data_size) > > { > > . > > . > > . > > } > > > > SV* yenc_encode_c_for_perl(unsigned char* data, size_t data_size) > > { > > SV * ret; > > char * s; > > s = _yenc_encode_c(data, data_size); > > > > ret = newSVpv(s, 0); > > free(s); > > return ret; > > } > > » > > > > And then use yenc_encode_c_for_perl() in your Perl program. > > > > Regards, > > > > Shlomi Fish > > > > P.S: does the «SV * ret» need to be made mortal? > > > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQEcBAEBCAAGBQJWDZS6AAoJEJ/OLjwuDYzK1bEIAK2i5tQfZkEAFoRqCLZ93IuH > Ya0QVgAs/obdBHWLcGv5lQlVc3RgdFX1/2Nl7sJV3Waiqos9921IjQdbw97z4M99 > OMVMI1UabjWrvhRHUc7IIhp6fJq4bRvKmiDF5j2BaRlrX101iszrmESHVllAE6iD > ava+WtJbIsfG168p/QB5Y9vdvCypXx4ZIPUkZf3YBzRm8z7w+Xjh6u1GdZuGZdpi > Vadm2t1AFgcuKjNpvSoRTeH+hMuphiPaxEVqmFLGpapM5KJp2YckLKMGH9cUsL7d > qe+iEvXVIXoMLR9qGPNLVvgb1P299WQ3yRTcIpMK3r4PsSQtAbv9JtAWa+Msi9U= > =9Vxg > -----END PGP SIGNATURE----- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJWDuPnAAoJEJ/OLjwuDYzK3PwIAIvlqyje9yKOqG+veIkpgq+H xqB47KnDD9CEtZhptSW7/GKWzt9FDBhL1ED+Puy1XrB0xzRNP4D0jGdv57l2MFbz 0zUwkIl7gCWPYnn2hVcumv7U2esyvrTc//is35xj9xWmvqa2DDvHOmcBkOjpvcWB bhzjYkyZZcqa6zj73X5z6m7ln/FE4/SKNtl7DQp5dDQeCVDH+eHjl+ddA3ofr56a NQMAoqJveNxlgV/BcsQV8Fto0zPbD3UU7+pKFSB6AJyFNTDW9OPacws3azxzuQGV 7CE9JxkKNo85XmF2saQyN70c0wEiqpiJiCETUqxX8qE2TjkYmoT3669D/DDZGI8= =da4X -----END PGP SIGNATURE-----