mod_perl memory...

2010-05-28 Thread Nishikant Kapoor

Hello,

Following the thread 
http://www.gossamer-threads.com/lists/modperl/modperl/101225, I came up 
with the following sub to display the output but the memory usage 
continues to build up without limit when web pages are rendered. Any 
suggestion/pointer would be greatly appreciated.


Here is the sub that outputs the page ($data is the entire web page in 
one go, using HTML::Template):


sub sendOutput {
  my $r = shift;
  my $data = shift;

  $r->content_type("text/html; charset=UTF-8");

  my $ba=$r->connection->bucket_alloc;
  my $bb=APR::Brigade->new($r->pool, $ba);

  $bb->insert_tail(APR::Bucket->new($ba, $data));
  $bb->insert_tail(APR::Bucket::flush_create $ba);
  $r->output_filters->pass_brigade($bb);
  $bb->cleanup;

  $bb->insert_tail(APR::Bucket::eos_create $ba);
  $r->output_filters->pass_brigade($bb);

  return;
}

And, here is the 'free' snapshot every ten seconds (trimmed):
  total   used   free
Mem: 262144  34668 227476
Mem: 262144  48432 213712
Mem: 262144  53392 208752
Mem: 262144  64360 197784
Mem: 262144  60760 201384
Mem: 262144  38980 223164
Mem: 262144  56440 205704
Mem: 262144  57436 204708
Mem: 262144  77364 184780
Mem: 262144 107568 154576
Mem: 262144 123388 138756
Mem: 262144 138628 123516
Mem: 262144 149004 113140

Thanks,
Nishi


Re: mod_perl memory...

2010-05-28 Thread Perrin Harkins
On Fri, May 28, 2010 at 7:00 AM, Nishikant Kapoor  wrote:
> http://www.gossamer-threads.com/lists/modperl/modperl/101225, I came up with
> the following sub to display the output but the memory usage continues to
> build up without limit when web pages are rendered. Any suggestion/pointer
> would be greatly appreciated.

There's discussion of the things that usually lead to memory growth in
the online documentation.  You probably need to find a request that
you can repeat that causes growth, and then take things out of it
chunk by chunk until you find the offending code.

- Perrin