From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1KwwbO-0003AG-Kb for garchives@archives.gentoo.org; Mon, 03 Nov 2008 10:24:06 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D159DE01D8; Mon, 3 Nov 2008 10:24:05 +0000 (UTC) Received: from bossdog.realss.com (bossdog.realss.com [211.157.114.130]) by pigeon.gentoo.org (Postfix) with ESMTP id 26DD2E01D8 for ; Mon, 3 Nov 2008 10:24:05 +0000 (UTC) Received: from localhost (unknown [127.0.0.1]) by bossdog.realss.com (Postfix) with ESMTP id 25B741C8001 for ; Mon, 3 Nov 2008 18:24:24 +0800 (CST) Received: from bossdog.realss.com ([127.0.0.1]) by localhost (bossdog.realss.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 02752-19 for ; Mon, 3 Nov 2008 18:24:23 +0800 (CST) Received: from [192.168.1.101] (unknown [61.149.141.201]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by bossdog.realss.com (Postfix) with ESMTP id DFDCD1C002F for ; Mon, 3 Nov 2008 18:24:22 +0800 (CST) Message-ID: <490ED140.8030109@realss.com> Date: Mon, 03 Nov 2008 18:24:00 +0800 From: Zhang Weiwu Organization: Real Softservice User-Agent: Thunderbird 2.0.0.14 (X11/20080621) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 To: gentoo-user@lists.gentoo.org Subject: [gentoo-user] limit maximum memory size of any process X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at bossdog.realss.com X-Archives-Salt: 16e888c9-11ed-40ae-b6f5-f7744258e4b2 X-Archives-Hash: 1b56d8d366765bf35e5477a33f96c75f Hello. In my daily us of computer any process that takes more than 50% of the memory (I read from top, not knowing if this is 50% of 384MB physical or 50% of having 800MB swap counted in) must have gone wrong, and usually drag performance down to such extent that killing it is impossible (because not possible to launch a terminal window to type kill -TERM). Examples are: 1. Firefox opens a broken website that wish to send 10M binary content to the browser window; 2. OpenOffice opens a document incorrectly; 3. Mistake in Java software (usually it keep eating memory); I hope I can configure the system so that any process uses more than 50% of memory are automatically killed. first I was recommend to use ulimit by googling around. However this seems doesn't work even if I set both -d and -m (here is my .xinitrc) ~$ cat .xinitrc #export XMODIFIERS=@im=FCITX #fcitx & ulimit -d 300000 ulimit -m 300 exec /usr/bin/fluxbox Result: OpenOffice stands still even when it takes 80% memory (read from top). So: is ulimit the solution? If so, what option should I set? My current ulimit is: $ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) 300000 scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 3072 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) 300 open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 3072 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited -- Real Softservice Huateng Tower, Unit 1788 Jia 302 3rd area of Jinsong, Chao Yang Tel: +86 (10) 8773 0650 ext 603 Mobile: 159 1111 7382 http://www.realss.com