Slashdot Mirror


Postmortem Memory Profiling with Perl

Irish writes "Problems with memory, such as leaks and memory-greedy applications can cause many problems for application developers; more so for wireless applications due to the prevalence of memory-constrained devices as platforms. This article shows you how to avoid memory problems and it shows how to use Perl script to analyze memory issues for later repair. It offers three progressively more sophisticated solutions to demonstrate the concept."

11 comments

  1. What you learn from reading the title, only: by dk.r*nger · · Score: 5, Funny

    When you die, the coroner can now attach a Perl program to your brain and find out what you were thinking.

    CSI is going to be very boring now.

    1. Re:What you learn from reading the title, only: by treat · · Score: 1

      I saw a movie where they could do this. It seems plausible. I'm sure they would have to cut the brain up into little pieces. Do we know how much of the brain degrades soon after death to be able to judge whether this is possible in theory?

  2. Isn't it ironic? by Linux_ho · · Score: 2, Funny

    Using Perl to fix memory problems.

    --
    include $sig;
    1;
    1. Re:Isn't it ironic? by William+G.+Davis · · Score: 2, Insightful

      No, it isn't. It would be ironic if Perl itself, the interpreter, was full of memory leaks and buffer overflows or if the language forced you to do your own error-prone memory management, but neither of which is the case.

      Perl, the interpreter, is one of the most stable pieces of software I've ever used, virtually devoid of buffer overflows and memory leaks, and it takes care of all of the memory management for you.

    2. Re:Isn't it ironic? by Linux_ho · · Score: 1
      No, it isn't. It would be ironic if Perl itself, the interpreter, was full of memory leaks and buffer overflows or if the language forced you to do your own error-prone memory management, but neither of which is the case.

      Perl, the interpreter, is one of the most stable pieces of software I've ever used, virtually devoid of buffer overflows and memory leaks, and it takes care of all of the memory management for you.
      I agree that the interpreter is very stable and has very few problems. I like Perl quite a bit. I'm not interested in starting a flamewar. But I still think it's ironic. I wouldn't exactly call Perl processes lightweight.

      $ sudo perl -MCPAN -e shell
      cpan> install SenseOf::Humor
      cpan> exit
      --
      include $sig;
      1;
    3. Re:Isn't it ironic? by William+G.+Davis · · Score: 1
      But I still think it's ironic. I wouldn't exactly call Perl processes lightweight.

      Neither would I, but that still doesn't make it ironic.

      $ make sense
  3. Excuse me.. by MooCows · · Score: 4, Insightful

    But what is the big deal here?
    We've had this kind of memory leak tracing for ages (simple C++ macro's to wrap around 'new' and 'delete' is one example)
    Ok, so we're doing it externally with perl now, yay.

    And by the way:
    ... could be achieved in C by replacing the allocate calls with a macro that inserts the filename and line number. Alternatively, add a parameter (string/number) to the allocate function and then preprocess the source with an external tool (PERL script, for example) that puts a unique value in each call to a memory function.

    If you need to edit the source, then why use an external script in the first place?

    --
    The path I walk alone is endlessly long.
    30 minutes by bike, 15 by bus.
  4. Reinventing the wheel by isj · · Score: 4, Informative

    The author has reinvented the wheel. Any debug heap that provides a trace can do this, so this is basically an old hat.
    http://www.cbmamiga.demon.co.uk/mpatrol/mpat rol_83 .html provides a very good list of resources for debug heaps.

  5. "PERL" by Anonymous Coward · · Score: 0

    We know from the article title that the author is not adept with Perl. The language is "Perl", the interpreter is "perl", and there is no PERL. The camel and llama books make this *very* evident.

  6. ahh, crap, it's not for *perl programs* by Anonymous Coward · · Score: 0

    I thought this would help me track memory in my Perl programs. I've got plenty of tools for C/C++, thanks.....

    of course I admit that if I really cared about memory I wouldn't use perl, but sometimes you get stuck with things!