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

Our PERL application has a lot of memory leaks and we need to identify which program and which line of code in the program causes the leaks. I'm fairly new to PERL programming. I have worked with such tools for Java programs but am not aware of any such tool for PERL programs. Please recommend me a Memory Profiling Tool that works with PERL applications. Thanks, MBS
  • Comment on Tools for identifying memory leaks in PERL application ?

Replies are listed 'Best First'.
(Ovid) Re: Tools for identifying memory leaks in PERL application ?
by Ovid (Cardinal) on Feb 01, 2002 at 18:42 UTC

    I'd also be curious to know if there are any tools that can do this for you. In the meantime, there are a few things that you can do to resolve this. First, if you are using 5.6.0, upgrade to 5.6.1. 5.6.0 is known to have quite a few memory leaks. Also, check to see if you have any circular references. Perl's garbage collection relies on reference counting and circular references need to be broken in the code or else those items won't get garbage collected.

    Other causes of memory leaks can be poorly scoped code or poorly designed code. Using external applications with Perl can also cause issues. What OS are you running on? What tools are you using? Are you writing any XS or Inline code (Inline can cause issues if you fail to declare scalars as mortal). Are you forking anything or using threads? There are so many ways to introduce leaks that it's tough to say what's happening without a better idea of what you are doing.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Tools for identifying memory leaks in PERL application ?
by theorbtwo (Prior) on Feb 01, 2002 at 19:09 UTC
Re: Tools for identifying memory leaks in PERL application ?
by perrin (Chancellor) on Feb 01, 2002 at 23:40 UTC