Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^7: Memory leak question

by BrowserUk (Pope)
on Oct 05, 2010 at 16:03 UTC ( #863631=note: print w/replies, xml ) Need Help??


in reply to Re^6: Memory leak question
in thread Memory leak question

NP. I really didn't do that much. I just looked inside to see if anything rang any bells, and the given/when thing did.

But I was unsure of my memory, so I made the changes I described to confirm them before reporting them. I didn't want to groundlessly poison the construct.

Replies are listed 'Best First'.
Re^8: Memory leak question
by SBECK (Hermit) on Oct 05, 2010 at 19:03 UTC
    Okay, I've now changed all given/when to if/elsif/else, and it has improved things, but it is still leaking (just not as fast).

    I'd love to reduce the leakage even further. If I understand it correctly, one source of data leaks is if the value of a variable is actually a nested structure (so it has refs in it) and I set the value to something else, the old value is destroyed (assuming a refcount of 0), but any data referenced by it may not be automatically destroyed. Is that correct? I'm fairly sure that this happens, but I'm really not looking forward to a code audit of the thousands of lines of code to track this down.

    Is there a good tool that I can use that will tell me every line number in the module where a variable was set to a new value and the old value was destroyed, but part of it hung around? Then, I could recursively destroy the old value before I created a new value (there's probably even a module to help me do this).

    This, or any other suggestions would certainly be welcome. I'm afraid that in all the time I've been programming perl, I've never tried tracking down a memory leak, and I'm mainly just stumbling around in the dark I'm afraid.
      Is there a good tool that I can use that will tell me every line number in the module where a variable was set to a new value and the old value was destroyed, but part of it hung around? Then, I could recursively destroy the old value before I created a new value (there's probably even a module to help me do this).

      I'm the wrong person to ask. Most of the tools I've seen suggested for this--including Devel::LeakTrace & Devel::LeakTrace::Fast--don't run on my platform, so I've evolved other, source-code based, techniques.

      I've seen many references to a *nix tool: valgrind, but I've no experience of it.

      If you can send me a copy of your latest code, I could have a go using my limited techniques while you research the tools?


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
        I've been using both of these... but the output is cryptic (to me at least... I suspect someone for who memory leak tracing is second nature find them more than adequate). I played just a bit with valgrind too... I may spend some additional time with it.

        I'd certainly appreciate you looking at my module... but I don't expect you to. You've already given me tons of help. If you're up for it though, I've placed a copy: http://sullybeck.com/Date-Manip-6.13.tar.gz It's a little bigger than I wanted to include as an attachment.

        Thanks again.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2019-06-19 14:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (88 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!