Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Busted: Strange memory leak question. Please help!

by catsophie (Initiate)
on Sep 22, 2007 at 05:19 UTC ( [id://640482]=note: print w/replies, xml ) Need Help??


in reply to Re: Strange memory leak question. Please help!
in thread Strange memory leak question. Please help!

Thank all for quick helps. Bellow is my report on the question.

talexb, I suspect my Perl program consumed my memory by using 'free -m' to look at the free memory. When I ran the Perl program, free memory decreased very fast and did not release after the Perl program stopped.

Fletch, you got the point. I forgot to delete the tree. Since I called HTML::TreeBuilder many times, that caused a serious memory wastage. After I deleted the tree, the memory leaking was almost solved.

When I say 'almost', I mean there is still very slow memory leaking, like 1M bytes several minutes. graff is right, the trouble comes from my large script (1305 lines :P). I should break the script into smaller components.

I didn't try Devel::Cycle and Test::Memory::Cycle, since I did not have complex reference structures.

  • Comment on Busted: Strange memory leak question. Please help!

Replies are listed 'Best First'.
Re: Busted: Strange memory leak question. Please help!
by sfink (Deacon) on Sep 22, 2007 at 16:10 UTC
    That is not a good way to detect a memory leak. You are looking at the total free memory on the system, which could go up or down due to pretty much anything happening on that box. It only worked for you because the leak was so large.

    Far better would be to find the pid of your process and run ps l on it periodically. Look at the VSZ column. If it never changes, then you don't have a leak.

      Thank sfink, I got it!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found