Re: On memory consumption - request for comments

Torsten Förtsch <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On Thursday, February 24, 2011 09:29:23 Max Kanat-Alexander wrote:
> On 02/23/2011 11:40 PM, Torsten Förtsch wrote:
> > On Thursday, February 24, 2011 07:45:29 Max Kanat-Alexander wrote:
> >>      Hey Fred. So given the discussion that we've had on this, do you
> >> think that the next version of SizeLimit could change its Linux
> >> behavior to return the more appropriate rss size?
> >
> > 
> >
> > yes
> 
>         Awesome, thank you. :-)

Max, could you please check if the following patch does what you want and try 
it out in your environment?

Index: lib/Apache/SizeLimit/Core.pm
===================================================================
--- lib/Apache/SizeLimit/Core.pm        (revision 1069512)
+++ lib/Apache/SizeLimit/Core.pm        (revision 1069513)
@@ -117,9 +117,9 @@
 sub _check_size {
     my $class = shift;
 
-    my ($size, $share) = $class->_platform_check_size();
+    my ($size, $share, $unshared) = $class->_platform_check_size();
 
-    return ($size, $share, $size - $share);
+    return ($size, $share, defined $unshared ? $unshared : $size - $share);
 }
 
 sub _load {
@@ -176,7 +176,9 @@
     return $class->_linux_size_check() unless $USE_SMAPS;
 
     my $s = Linux::Smaps->new($$)->all;
-    return ($s->size, $s->shared_clean + $s->shared_dirty);
+    return ($s->size,
+           $s->shared_clean + $s->shared_dirty,
+           $s->private_clean + $s->private_dirty);
 }
 
 sub _linux_size_check {


Torsten Förtsch

-- 
Need professional modperl support? Hire me! (http://foertsch.name)

Like fantasy? http://kabatinte.net
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.