Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Nested Calls, Recursion and MEMORY

by robdog (Novice)
on Dec 19, 2002 at 22:31 UTC ( #221273=note: print w/ replies, xml ) Need Help??


in reply to Re: Nested Calls, Recursion and MEMORY
in thread Nested Calls, Recursion and MEMORY

Thanks for your reply.

The test code is not broken though. The "recurse" function is really recursive, and goes down 2 levels deep. The "recurse1" actually calls "recurse2". This just a 2 level deep nested call. Which pretty much does the same thing as "recurse".

calling recurse, leaves blocks..
calling recurse1, leaves no blocks..

In both examples, they should be saving the same # of call stacks. They essentially do the same thing, they both do a 2 level deep nested call, except that "recurse" calls itself. That is basically the only difference between the two.

so..to rephrase what u said,
Everytime i make another function call (either to myself or another function), Perl has to save another stack frame. When you return (either from myself or another function), Perl pops that frame off the stack.

What im getting at, is that calling yourself or another function in a nested fashion _should_ do the same thing.

but doesnt appear so.

thanks for taking the time to read and answer.


Comment on Re: Re: Nested Calls, Recursion and MEMORY

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2014-12-29 02:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (184 votes), past polls