LFD should use resident memory instead of virtual memory

5 posts Page 1 of 1
mikerobinson
Junior Member
Posts: 8
Joined: 18 Feb 2010, 23:51


Virtual memory doesn't cost anything. I could have a process that maps a large file on my hard drive and this will be through the roof. I got the following error today:
Time: Sat Aug 11 21:59:45 2012 -0600
Account: mike
Resource: Virtual Memory Size
Exceeded: 1110 > 1000 (MB)
Executable: /usr/bin/kmix
Command Line: /usr/bin/kmix -session 10108152142da000133799057900000022270010_1344454058_238350
PID: 2675
Killed: No
However KDE system activity reports this PID as only using ~8 MB and the total private + shared memory is ~14 MB:
$ cat /proc/2675/status | grep VmRSS
VmRSS: 14704 kB
Should I really be worried if a process is eating up gigabytes of virtual memory? I would be much more concerned if that was resident memory. So my suggestion would be to either use resident memory instead of virtual memory, or provide an option for each. In the KDE system activity it even says about the virtual memory usage: "this number is almost meaningless".
mikerobinson
Junior Member
Posts: 8
Joined: 18 Feb 2010, 23:51


The fix is super simple:

In /usr/sbin/lfd, line 3106 change:
Code: Select all
if ($line =~ /^VmSize:\s+(\d+) kB$/) {$vmsize = $1}
to:
Code: Select all
if ($line =~ /^VmRSS:\s+(\d+) kB$/) {$vmsize = $1}
and line 3342, change:
Code: Select all
$resource = "Virtual Memory Size";
to:
Code: Select all
$resource = "Memory Usage (RSS)";
And if you want, change all occurrences of the variable $vmsize to $vmrss.
mikerobinson
Junior Member
Posts: 8
Joined: 18 Feb 2010, 23:51


Since there are many people who already have csf/lfd installed, I would assume that the above fix would not be the best idea since virtual memory usage tends to be significantly higher than physical memory usage, so making the above changes would likely mean that many processes should be killed but aren't. I would think that adding another option (e.g. PT_USERMEM_RSS) to the configuration file would be a much better idea. I would be more than willing to code this myself, however I don't see anywhere where you can commit code to the project, so I fear that it would be a waste of time. Please contact me if there is some way for me to add these changes and if this would be something that the dev(s) would be interested in having in the project.
bouvrie
Junior Member
Posts: 13
Joined: 23 Nov 2011, 09:49


I vote +1 on the PT_USERMEM_RSS feature request as people tend to just put (php) processes on the ignore list to "get rid of the emails".

Reports that PHP scripts are infact using too much *resident* memory are much more helpful than reporting 'high' Virtual Memory. I would change my lfd script like mentioned above, only if it weren't for futuer LFD updates reverting the edit, and causing processes to be auto-killed (as Virtual Memory basically would always exceed the PT_USERMEM limit).
ForumAdmin
Moderator
Posts: 1279
Joined: 01 Oct 2008, 09:24


A feature that addresses this has been added to csf v9.29 which we have just released:
http://blog.configserver.com/
5 posts Page 1 of 1