Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^6: Why is the size even bigger after pack?

by PerlOnTheWay (Monk)
on Nov 04, 2011 at 01:30 UTC ( [id://935811]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Why is the size even bigger after pack?
in thread Why is the size even bigger after pack?

You mentioned it's in previously allocated memory

why??Isn't it created on the fly?

Perl allocates more memory than required for string, that's what xpv_cur/xpv_len is there for

Replies are listed 'Best First'.
Re^7: Why is the size even bigger after pack?
by ikegami (Patriarch) on Nov 04, 2011 at 03:01 UTC

    No, the SV body isn't created at all for SVt_IV scalars.

    A SV usually has a head block and a body block (that's in addition to any string buffer, etc). SVt_IV scalars, rather exceptionally, don't have a body. Or rather they have a body, but it's location overlaps the head so that it never needs to be allocated.

    5.12, 64 bit ints, 64 bit floats - - -+ <---+ : | : +04 | Usual SV head SVt_IV : | --> +-----------------+ --> +-----------------+ +08 | | Pointer to body ------+ | Pointer to body ------+ +04 | | | +04 | | +0C | | | | | +08 +-----------------+ | +08 +-----------------+ +10 | REFCNT | | | REFCNT | +0C +-----------+-----+ | +0C +-----------+-----+ +14 | FLAGS | SVt | | | FLAGS | SVt | +10 +-----------+-----+ | +10 +-----------+-----+ +18 | PV ---> +---------- | | IV/UV | +14 | | ... | +14 | | +1C | +---------- | | | +18 +-----------------+ | +18 +-----------------+ +20 | Usual SV body | +-----------------+ <---+ | NV | | | +04 | | +-----------------+ +08 | CUR | | | +0C | | +-----------------+ +10 | LEN | | | +14 | | +-----------------+ +18 | IV/UV | | | +1C | | +-----------------+ +20
      Can you represent it with an image instead?
        That is an image. Be more specific.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://935811]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (2)
As of 2024-04-20 04:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found