Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: Shrunk array takes more memory than original

by dave_the_m (Monsignor)
on Nov 10, 2015 at 13:12 UTC ( [id://1147356]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Shrunk array takes more memory than original
in thread Shrunk array takes more memory than original

Because using $#array causes some magic to be attached to the array.
Technically speaking, a temporary magic object is created that points to the array. When the object is assigned to, it truncates the array. This object is freed (well, returned to the pool anyway) at the end of the statement. The array itself never gains any magic.

Dave.

  • Comment on Re^4: Shrunk array takes more memory than original

Replies are listed 'Best First'.
Re^5: Shrunk array takes more memory than original
by BrowserUk (Patriarch) on Nov 10, 2015 at 13:16 UTC
    This object is freed (well, returned to the pool anyway) at the end of the statement.

    Thanks for the correction. But it does raise the question of what is in those 184 bytes that remain?


    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". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 19:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found