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!