Re: Debugging memory allocation

2005-05-10 Thread Igor Chudov
I already have a function to get memory usage, borrowed from Zpache::SizeLimit and modified. sub linux_memory_size { my($size, $resident, $share) = (0, 0, 0); my $file = "/proc/self/statm"; if (open my $fh, "<$file") { ($size, $resident, $share) = split /\s/, scalar <$fh>; close $

Re: Debugging memory allocation

2005-05-10 Thread Perrin Harkins
On Tue, 2005-05-10 at 15:59 -0500, David Nicol wrote: > Undoubtably. But how do you get the memory usage? read /proc/$$/mem or > something? That's what Apache::SizeLimit does, and it was as fast as Apache::GTopLimit the last time I checked it. - Perrin

Re: Debugging memory allocation

2005-05-10 Thread David Nicol
On 5/10/05, Igor Chudov <[EMAIL PROTECTED]> wrote: > LogHandler seems > like such a place. Undoubtably. But how do you get the memory usage? read /proc/$$/mem or something? there is not, AFAICTFRAQG (as far as I can tell from recollection and quick googling) a line noise variable for current memo

Re: Debugging memory allocation

2005-05-10 Thread Stas Bekman
Can you point me to some LogHandler example that works under the latest released mod_perl 2.0? http://perl.apache.org/docs/2.0/user/handlers/http.html#PerlLogHandler -- __ Stas BekmanJAm_pH --> Just Another mod_perl Ha

Re: Debugging memory allocation

2005-05-10 Thread David Nicol
how about declaring something like sub LogMemoryUsage(){ open PIDLOG, ">>pidlog"; flock PIDLOG, LOCK_EX; print PIDLOG, "$$ $ENV{SCRIPT_NAME} ",`ps -p $$ -os` close PIDLOG; }; and then calling LogMemoryUsage() at the beginning (and end) of every routine that you suspect might have the

Re: Debugging memory allocation

2005-05-10 Thread Igor Chudov
I have a lot of code in a lot of places, and something like 2-3 hits per second. It is a relatively busy website. I cannot afford doing what was just suggested, I would prefer some indirect perl invocation at the appropriate place. LogHandler seems like such a place. i --- David Nicol <[EMAIL PR

Re: Debugging memory allocation

2005-05-10 Thread Igor Chudov
--- Sam Tregar <[EMAIL PROTECTED]> wrote: > On Mon, 9 May 2005, Igor Chudov wrote: > > > I would like to at least have a log that lists > pid, > > page requested, parameters, starting memory and > memory > > after the request was processed. O rsome other > ideas > > like that. Any thoughts? > >

Re: Debugging memory allocation

2005-05-09 Thread Perrin Harkins
On Mon, 2005-05-09 at 14:46 -0400, Sam Tregar wrote: > On Mon, 9 May 2005, Igor Chudov wrote: > > > I would like to at least have a log that lists pid, > > page requested, parameters, starting memory and memory > > after the request was processed. O rsome other ideas > > like that. Any thoughts? >

Re: Debugging memory allocation

2005-05-09 Thread Sam Tregar
On Mon, 9 May 2005, Igor Chudov wrote: > I would like to at least have a log that lists pid, > page requested, parameters, starting memory and memory > after the request was processed. O rsome other ideas > like that. Any thoughts? Check out GTop.pm. You should be able to write a LogHandler whic

Debugging memory allocation

2005-05-09 Thread Igor Chudov
my website algebra.com is 100% mod_perl. I use Apache::SizeLimit to kill my httpd children when they grow too big. What I do not like is that they grow. Sometimes they would live for a couple of hours, and sometimes they would die after 5 minutes and not so many requests. I would like to at least