Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Memory leak detection

by runnerup (Novice)
on Sep 07, 2014 at 15:55 UTC ( [id://1099812]=note: print w/replies, xml ) Need Help??


in reply to Re: Memory leak detection
in thread Memory leak detection

The code itself is over 2000 lines, so I think it would be difficult to post or analyze.
However, my question is actually how can ARENA COUNTS show
69084 REF-Tie::RefHash::Weak

when all the adding all the scalar(keys %HASHS) of all the hashes using Tie::RefHash::Weak, scalar(keys %EACHHASH) added together is much much less than 69084.
Is there any common case that can happen?
I am deleting the keys like delete($hash($key)).
All the keys are to Danga::Socket::GCallback, so there should be no circular references possible.

Replies are listed 'Best First'.
Re^3: Memory leak detection
by andal (Hermit) on Sep 08, 2014 at 06:48 UTC
    However, my question is actually how can ARENA COUNTS show 69084 REF-Tie::RefHash::Weak when all the adding all the scalar(keys %HASHS) of all the hashes using Tie::RefHash::Weak, scalar(keys %EACHHASH) added together is much much less than 69084.

    That is why they call it "memory leak" :) The "arena" goes through internal perl structures to see which structures are allocated. As long as variable is accessible from the user code, it is "good" structure. The problem comes, when the structure is not accessible from user code. This structure is then "leaked". So, if you have a leak, then you won't be able to see leaked structures from your perl code. Of course in this case your count won't match the count of "arena".

      Other than cyclic references (which I don't think could exist in my code), do you know what could cause this to happen?
      I would think that if the reference count is 0, that the objects would be deleted.
      What approach should I use to find the problem?
        Other than cyclic references (which I don't think could exist in my code), do you know what could cause this to happen?

        Well, circular references do not have to be direct. There are lots of subtle ways for creating them. That makes finding them very complex at times.

        I don't know about any other reason for perl to keep unused objects around.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-25 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found