in reply to CGI::Application + mod_perl =|!= memory leak

First, you need to understand the implications of a persistent Perl interpreter. When Perl loads something into a lexical variable and the lexical goes out of scope, it doesn't release that memory. This is an optimization, assuming you will probably use that variable again. What this means is that if you load a big file into memory (and remember that Perl takes a lot more RAM to store something than it takes on disk), you will permanently add the size of that file to your process.

However, you should not see any growth if you just keep loading the same file over and over again. If that's what you see, then you may have a bug somewhere.

The second thing to understand is that this is probably a bad idea. Why serve a static image from your dynamic script? Why not simply redirect or serve it straight from apache?

If you really must serve the image yourself, look at Apache::File. There's an example of using it in the Eagle book.

  • Comment on Re: CGI::Application + mod_perl =|!= memory leak