Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^5: Trouble getting size of list returned from sub

by ColonelPanic (Friar)
on Nov 26, 2012 at 15:40 UTC ( #1005697=note: print w/replies, xml ) Need Help??

in reply to Re^4: Trouble getting size of list returned from sub
in thread Trouble getting size of list returned from sub

Sure it is

I responded to your earlier claim that memory from lexical variables is returned to the OS, based on both a statement from the Perl FAQ and evidence from testing. So, simply continuing to assert your previous position without any new argument is not going to cut it. I would be happy to learn how I am wrong on this, but if I am wrong please explain why.

No, you're copying the list...

This appears to be a response to the subroutine solution I posted below. Again, the evidence from testing seems clear enough--it uses less memory than the solutions that explicitly or implicitly make a copy of the array. In this case, my assumption was that the list returned from the first function call is left on the stack and used as the arguments for the second function call. @_ then refers directly to the stack, and thus no new copy is made. Again, I would be happy to be proved wrong on this.

Note: I'm assuming you're the same Anonymous Monk as the previous one here. My apologies to both of you if that is incorrect.

When's the last time you used duct tape on a duct? --Larry Wall
  • Comment on Re^5: Trouble getting size of list returned from sub

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005697]
[Corion]: A good morning!
[Discipulus]: good morning Corion!
[Corion]: I spent parts of yesterday digging into Filter::Simple to make it not change the line numbers of unfiltered code, but I think I need regex help (which will come in a SoPW I guess). I tried @lines = /((?:"...."|[^" \n]+)\n)/gs, but that matched on...
[Corion]: ... foo "\0\0\0\n" bar\n by matching the first \n instead of matching the four-bytes-in- double-quotes part
[Corion]: ... and I still don't understand why ;)
[Corion]: This is because Filter::Simple does some string-trickery, replacing all string literals with "quoted packed numbers"

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-01-23 08:02 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (191 votes). Check out past polls.