$ gdb /usr/local/bin/perl core ... Core was generated by `/usr/local/bin/perl -lw ./959669.pl 128'. Program terminated with signal 11, Segmentation fault. #0 0x00007f8382eb85c5 in new (classname=0x11b1170 "fred", bits=) at test.xs:23 23 SvLEN_set( obj, bytes ); (gdb) q #### ... obj = newSV_type(SVt_PV); SvPOK_only( obj ); SvPV_set( obj, vector ); SvLEN_set( obj, bytes ); SvCUR_set( obj, bytes ); ... __END__ $ ./959669.pl 128 ... SV = PVMG(0x1068f90) at 0xfb8d80 REFCNT = 1 FLAGS = (OBJECT,POK,pPOK) IV = 0 NV = 0 PV = 0x149cfa0 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" CUR = 16 LEN = 16 STASH = 0xfd4f08 "fred"