Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: Could we save the memory occupied by "undef" in an array?

by matrixmadhan (Beadle)
on Nov 23, 2008 at 08:24 UTC ( [id://725399]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Could we save the memory occupied by "undef" in an array?
in thread Could we save the memory occupied by "undef" in an array?

This looks interesting

Would you mind if I request you to explain that?

Could you please explain the Dumper output if you have some free time?

Thanks
  • Comment on Re^4: Could we save the memory occupied by "undef" in an array?

Replies are listed 'Best First'.
Re^5: Could we save the memory occupied by "undef" in an array?
by ikegami (Patriarch) on Nov 23, 2008 at 16:32 UTC

    Could you please explain the Dumper output if you have some free time?

    By "I think" and "if I read what follows correctly", I meant to communicate that I'm not clear on the details relevant to this conversation. I've already described the relevant details beyond my understanding.

    The only other relevant details might be FILL = 3 (4 elements are visible) and MAX = 3 (4 elements have been allocated). Perl sometimes allocate a larger array than it needs to speed up future push statements. It also has the option to speed up pop statements by not resizing the allocated block.

    >perl -MDevel::Peek -le"@a=qw(a b c); Dump(\@a, 1); pop @a; Dump(\@a, +1)" SV = RV(0x183c550) at 0x2260b4 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x226dbc SV = PVAV(0x22bfcc) at 0x226dbc REFCNT = 2 FLAGS = () IV = 0 NV = 0 ARRAY = 0x1833fc4 FILL = 2 # 0..2 in use MAX = 3 # 0..3 allocated ARYLEN = 0x0 FLAGS = (REAL) SV = RV(0x183c550) at 0x2260a8 REFCNT = 1 FLAGS = (TEMP,ROK) RV = 0x226dbc SV = PVAV(0x22bfcc) at 0x226dbc REFCNT = 2 FLAGS = () IV = 0 NV = 0 ARRAY = 0x1833fc4 FILL = 1 # 0..1 in use MAX = 3 # 0..3 allocated ARYLEN = 0x0 FLAGS = (REAL)

    Would you mind if I request you to explain that?

    Did you ask the same question twice, or is this a different "that"?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 13:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found