Hi,
I have a Perl script running in mod_perl that needs to write a large amount of data to the client, possibly over a long period. The behavior that I observe is that once I print and flush something, the buffer memory is not reclaimed even though I rflush
(I know this can't be reclaimed back by the OS).
Is that how mod_perl operates and is there a way that I can force it to periodically free the buffer memory, so that I can use that for new buffers instead of taking more from the OS?
Just to clarify, I'm not using any buffers myself and there are no leaks in my code. Consider the following simple example:
sub handler {
my $request = shift;
my $boundary = time;
$request->content_type("multipart/x-mixed-replace;boundary=\"$boundary\";");
for (;;) {
$request->print("--$boundary\n");
$request->print("Content-type: text/html; charset=utf-8;\n\n");
$request->print("$data\n\n");
$request->rflush;
}
return Apache2::Const::OK;
}
This leaks heavily, and my request is being kept alive, so it may be active for days.