Re: memory leaks when using FAST CGI + Apache + Perl

Igor <[email protected]>
Newsgroups gmane.comp.web.fastcgi.devel
Organization ROL
Message-ID <[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.
    
    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.
    
    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.

-- 
Best regards,
 Igor                            mailto:[email protected]

___________________________________
fastcgi-developers mailing list
http://fastcgi.com/fastcgi-developers/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.