Re: memory leaks when using FAST CGI + Apache + Perl
"Alexey Melezhik" <[email protected]>
| Newsgroups | gmane.comp.web.fastcgi.devel |
|---|---|
| Message-ID | <[email protected]> |
2006/8/10, Igor <[email protected]>: > Hello Alexey, > > Thursday, August 10, 2006, 11:38:41 AM, you wrote: > > AM> We are using Apache 2 + FAST CGI + Perl. > AM> Recently we have noticed memory leak in our web application. When we > AM> `top' on web server it could be seen that memory allocated by user.cgi > AM> process keep growing up to 100-300 Mb. > > AM> I would be very appreciate for any help > > It might be a Fast CGI leak, but you would have to examine your > script's logic first, you may use Data::Dumper to do that. In most > cases developers forget that FastCGI application is running in > a loop and does not free memory after each web call, therefore the > memory leakage that was hidden so far becomes perceptible. I know that; We have faced memory leak just recenty; of course I tryed to use Data::Dumper, Devel::Peak, Devel::FindGlobals, etc, but we have about dozens of modules and thousands of code lines, it migth be trouble ti dump it all ;-) and esle unfortunately we use perl globals; > > And since developers are often refactoring their CGI into FastCGI > this might be the cause of your memory leakage. > > If the scripts is all right then it would be a good idea to check out > another Perl bundle. > We can't, project is too large to switch on another bundle; > And only if everything checked out all right the suspicions might > fall on Fast-CGI environment. > > BTW will this code eat memory? > > #!/usr/bin/perl > > use CGI::Fast; > &do_some_initialization(); > $ENV{FCGI_SOCKET_PATH} = "localhost:8888"; > $ENV{FCGI_LISTEN_QUEUE} = 100; > while ($q = new CGI::Fast) { > > } > > > also I have to deal with memory allocations by C fucntions, used in Perl; > > And this might be the trouble as well. Just run your script in a > for(;;){}; without any fast-cgi at all. > That's good idea; > -- > Best regards, > Igor mailto:[email protected] > > -- Alexey Melezhik ___________________________________ fastcgi-developers mailing list http://fastcgi.com/fastcgi-developers/