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

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?

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-06-17 20:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.