Think about Loose Coupling | |
PerlMonks |
Re^5: Tracking down memory leaksby Joost (Canon) |
on Apr 13, 2005 at 14:13 UTC ( [id://447395]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|