XS causes error on 5.8.9, help!
mark at twoshortplanks.com
Fri Jun 21 13:44:30 BST 2013
So I recently stole the guts of the Clone module, and modified it to allow it to create a copy of a data structure with all the strings in the data structure turned into the UTF-8 byte representation of the characters within it. I released it to the CPAN as Clone::AsUTF8Bytes.
And then I got some test failures on 5.8.9 reported to me via the excellent people at CPAN Testers. Inside the test report was:
Attempt to free non-existent shared string 'foo', Perl interpreter: 0xe2a010.
Uh oh. So, questions:
a) What does this error message mean? I *think* it means that the scalar that contains the string "foo" was attempted to be freed a second time, which is weird, because it's stored only in the original non-copied data structure after the copy takes place. This is someone compounded by the fact that the cloned copy of the data structure is now all screwed up, as you can see by the subsequent test failure:
b) Anyone seen this before? Is this just a known problem with an ancient yet widely deployed version of perl (I must admit my knowledge of XS isn't great, and knowledge of XS on 5.8 even less so) or am I doing something stupid? If it's the former, can it be (easily) fixed, or should I just bump the requirement to a working version of perl.
In the interests of those playing along at home, here's the source, failing tests, and a diff showing the changes I made on top of the original Clone code:
More information about the london.pm