On Jan 4, 2012, at 2:48 PM, Andrew Dunstan wrote:
>> That's kinda grotty ... and leaky ...
>>
>
> Of course it is. It wasn't meant as a solution but as validation of your suspicions about the nature of the problem.
(Theleakiness could be solved, though.)
From #p5p on irc.perl.org:
[10:58pm]dg:interesting, so SvPV() handles string overloading, but SvPVutf8() doesn't, yet: "Like C<SvPV>, but converts
svto utf8 first if necessary."
[10:58pm]dg:oh, only for readonly objects
[10:58pm]dg:probably why no-one has noticed, as version is probably the only readonly thing with string overloading
[11:08pm]TonyC:it doesn't need string overloading
[11:09pm]TonyC:https://gist.github.com/1562734
[11:12pm]TonyC:theory: using sv_mortalcopy() instead of newSVsv() should prevent the leak in that workaround, assuming
there'sno FREETMPS between the call and use of the return value
Useful?
David