Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Memory leak

by shaavrii (Initiate)
on Sep 05, 2007 at 20:00 UTC ( [id://637249]=perlquestion: print w/replies, xml ) Need Help??

shaavrii has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Memory leak
by Joost (Canon) on Sep 05, 2007 at 20:46 UTC
    Code just taking up more memory does not necessarily mean you've got a memory leak*. It may be that the algorithm chosen just takes up more memory while it's working, or that your code is inefficiently structured - i.e. you're keeping a lot of variables around that you don't need instead of using simple blocks/subroutines that automatically destroy unused variables.

    * IMO, a memory leak is what happens when you've got memory allocated that is *unreachable*. Perl is reasonably good at detecting and clearing those, except for circular references. If that's what you're trying to detect, you may want to take a look at Test::Memory::Cycle (note: I've never used it myself)

Re: Memory leak
by Fletch (Bishop) on Sep 05, 2007 at 20:37 UTC

    Well the leak is obviously on line 13054. Or maybe 13053. Somewhere around there, at any rate.

    A reading of How (Not) To Ask A Question and heeding the advice might produce more cogent help.

Re: Memory leak
by FunkyMonk (Chancellor) on Sep 05, 2007 at 21:25 UTC
    Ask your boss (or whoever it was that asked you to "detect" the leak), why he selected you, a Perl newcomer, to find it.

    If you don't know Perl, how are you expected to find a memory leak?

Re: Memory leak
by adrianh (Chancellor) on Sep 09, 2007 at 17:02 UTC
Re: Memory leak
by CountZero (Bishop) on Sep 06, 2007 at 16:25 UTC
    Why bother? Memory is cheap, just add lots and lots of memory to that machine and the memory leak problem will soon become insignificant.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-03-19 07:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found