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

I have a package that creates a rather large, nasty object with a lot of text fields. Apparently somewhere in there is a memory leak. Using commonly-held Perl wisdom, I did:
perl -MDevel::LeakTrace myscript.pl
Whereas the script by itself takes less than a minute to run, with LeakTrace it's been running for over an hour. WTH?
--
Jeff Boes
Database Engineer
Nexcerpt, Inc.
vox 269.226.9550 ext 24
fax 269.349.9076
 http://www.nexcerpt.com
...Nexcerpt...Connecting People With Expertise

Replies are listed 'Best First'.
Re: Memory leak, and Devel::LeakTrace takes too long
by ptkdb (Monk) on Oct 17, 2003 at 19:47 UTC
    Programs to track leaks often keep a database of every object allocated and deallocated, so for each object that gets created/deleted it has to update the database. The overhead can be considerable

    Suggestion: Cut down the amount of the input data that you're feeding it, or cut it up into chunks if different classes of data get processed by different parts of the program. This may help to isolate the problem.

Re: Memory leak, and Devel::LeakTrace takes too long
by graff (Chancellor) on Oct 18, 2003 at 16:48 UTC
    I'm afraid I'm a bit confused... You say that your script by itself takes less than a minute to run. So, what's the evidence (in fact, what's the big deal) that there's any sort of memory leak? I mean, if it finishes that quickly, why worry about it?

    Now, if there's a problem that it's producing bad output in some way, then there's something to fix, but I still don't get the relation between something like that and an idea that there's a memory leak. How about showing some of the evidence, and/or some of the code?