in reply to More 64-bit Perl bugs?

As for the additional memory, when you Devel::Peek::Dump() the reference (with a shorter string), you can see that a PV has been created after having accessed the string (via "magic").  My first guess would be this is some caching behavior to increase performance with repeated accesses.

use Devel::Peek; $v = chr(0); $v x= 50; $r = \substr $v, 25; Dump $r; vec( $v, 25, 8 ) = 0b10101010; print vec( $$r, $_, 1 ) for 0..7; Dump $r; __END__ SV = IV(0x7991e0) at 0x7991f0 REFCNT = 1 FLAGS = (ROK) RV = 0x771998 SV = PVLV(0x7a1ce0) at 0x771998 REFCNT = 1 FLAGS = (GMG,SMG) IV = 0 NV = 0 PV = 0 MAGIC = 0x7914f0 MG_VIRTUAL = &PL_vtbl_substr MG_TYPE = PERL_MAGIC_substr(x) TYPE = x TARGOFF = 25 TARGLEN = 25 TARG = 0x7991c0 SV = PV(0x76fc20) at 0x7991c0 REFCNT = 2 FLAGS = (POK,pPOK) PV = 0x7a4f50 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"\0 CUR = 50 LEN = 56 0 1 0 1 0 1 0 1 SV = IV(0x7991e0) at 0x7991f0 REFCNT = 1 FLAGS = (ROK) RV = 0x771998 SV = PVLV(0x7a1ce0) at 0x771998 REFCNT = 1 FLAGS = (GMG,SMG,pPOK) IV = 0 NV = 0 PV = 0x7917e0 "\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +0"\0 # <--- CUR = 25 LEN = 32 MAGIC = 0x7914f0 MG_VIRTUAL = &PL_vtbl_substr MG_TYPE = PERL_MAGIC_substr(x) TYPE = x TARGOFF = 25 TARGLEN = 25 TARG = 0x7991c0 SV = PV(0x76fc20) at 0x7991c0 REFCNT = 2 FLAGS = (POK,pPOK) PV = 0x7a4f50 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ +0\252\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"\0 CUR = 50 LEN = 56

Replies are listed 'Best First'.
Re^2: More 64-bit Perl bugs?
by BrowserUk (Patriarch) on Mar 14, 2012 at 16:09 UTC

    You're right. And it seems to have been that way since (at least) 5.8.9.

    Damn, that's dumb :(


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?