in reply to Re: Memory Leak with XS but not pure C
in thread Memory Leak with XS but not pure C
Thanks Nerdvana for your fast and very helpful reply!
Using newSVpvn in place of newSVpv does indeed solve the complaint from Valgrind. Also you were of course correct about the extraneous u8_strlen
I'm the epitomy of confusedness regarding Perl and unicode. Your tip to add "use utf8" was very useful as I'm passing the literal strings, and I added a check to the XS code prior to getting the string from the SV:
if(!SvUTF8(sv)) { sv = sv_mortalcopy(sv); sv_utf8_upgrade(sv); } s = SvPVutf8(sv, len)
As Marshall says below, the esszett is a strange character (well, it is German) as it uppercases to 'SS'. This happens with many characters of other languages too. The standard Perl uc just leaves it there when uppercasing. The libunisting library (not mine!) does it correctly.
Thanks again for the help!
|
|---|