Version: unknown (using KDE 3.4.0 Level "b" , SUSE 9.3 UNSUPPORTED) Compiler: gcc version 3.3.5 20050117 (prerelease) (SUSE Linux) OS: Linux (i686) release 2.6.11.4-20a-athlon-preempt One of the plugins running suddenly consumed all available memory (over 1.1GB!) causing my system to swap like crazy. I don't know which plugin caused the problem, or even if I can reproduce it, but it would be a good feature if nspluginviewer could limit the amount of memory it is allowed to use, similar to how it can run at a nice CPU level. I would much rather have nspluginviewer crash due to a buggy plugin than take down the whole machine.
SVN commit 415756 by staikos: add support for memory limits with hidden config variable. I may add a UI option if and when I receive positive feedback that this code works. I haven't tested it. FEATURE: 104338 M +11 -0 trunk/KDE/kdebase/nsplugins/viewer/viewer.cpp --- trunk/KDE/kdebase/nsplugins/viewer/viewer.cpp #415755:415756 @@ -37,6 +37,8 @@ #include <qptrlist.h> #include <qsocketnotifier.h> #include <stdlib.h> +#include <sys/resource.h> +#include <sys/time.h> #include <unistd.h> #ifdef Bool @@ -249,6 +251,15 @@ if (v > 0) { nice(v); } + v = cfg.readNumEntry("Max Memory", 0); + if (v > 0) { + rlimit rl; + memset(&rl, 0, sizeof(rl)); + if (0 == getrlimit(RLIMIT_AS, &rl)) { + rl.rlim_cur = kMin(v, int(rl.rlim_max)); + setrlimit(RLIMIT_AS, &rl); + } + } } // initialize the dcop client
*** Bug 106507 has been marked as a duplicate of this bug. ***
Hey George, I see this nice little setting is still in the 4SVN source.. you might think about that visible config option because my guess is noone ever found this ;)