Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Tracking down memory leaks

by Joost (Canon)
on Apr 13, 2005 at 14:13 UTC ( [id://447395]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Tracking down memory leaks
in thread Tracking down memory leaks

That's how I understand it, yes. Lexicals are re-used when iterating though a loop / subroutine note: recursive subroutine calls create a "stack" of lexicals - for obvious reasons - lookup goto &sub if you want to do tail recursion.

Ofcourse, if your program is structured well enough, you usually don't have to worry about it - what I mean is, if your variables go out of scope, you usually are going out of a sub or loop in which they will be used again.

The usual exception is some code that runs in stages, and you want to free as much memory as possible after you're done with one stage and enter the next, for instance, some code that needs to preprocess a lot of data in memory, write it out to a file and then go through the resulting file line by line - or something like that.

Log In?
Username:
Password:

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

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

    No recent polls found