List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:May 25 1999 8:41pm
Subject:Re: "SuratSingh Bhati" <>
View as plain text  
> Subject: Memory Leak with Perl & Mysql
> Date: Sun, 23 May 1999 13:35:37 PDT
> From: "SuratSingh Bhati" <suratbhati@stripped>
> To: msql-mysql-modules@stripped
> Hi ,
> I am using Perl & Mysql on my digital alpha m/c.
> Web server is Netscape Enterprise Server 3.6.
> This site having about 100000 hits per hour,
> But my server become slow after 2-3 hour , and
> I have to restart it,
> My unix admin syas this is due to memory leak , that may
> be due to coding of my CGI program,
> How I can check the memory leak of my program?
> How should I remove it?

That's a difficult problem, in particular for newbies as you seem
to be. (Sorry!)

I typically create sample input data and let the script run not only
once, but repeatedly. Then I watch the dize of the process. If it grows
permanently, there's a memory leak. (In most cases in your code and not
in Perl, MySQL or DBD::mysql.) For an example see the script t/60leaktest
from the Msql-Mysql-modules distribution.

Another idea is using a helper module like Devel::Leak, but understanding
that module requires a little bit knowledge of Perl's garbage collection.
On the other hand, garbage collection is the most evident reason for
memory leaks, so you probably need that anyways. :-)



Jochen Wiedmann						joe@stripped
Wiedmann'sches Idealgewicht: IQ - 30%			+49 7123 14887

Re: "SuratSingh Bhati" <>Jochen Wiedmann26 May