From owner-freebsd-questions@FreeBSD.ORG Sun Mar 10 00:07:49 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 709A96D1 for ; Sun, 10 Mar 2013 00:07:49 +0000 (UTC) (envelope-from tamino@wolfhut.org) Received: from pendor.wolfhut.org (pendor.wolfhut.org [173.228.91.225]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4611E9 for ; Sun, 10 Mar 2013 00:07:49 +0000 (UTC) Received: from [192.168.42.100] (173-228-91-224.static.sonic.net [173.228.91.224]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by pendor.wolfhut.org (Postfix) with ESMTPSA id 547B3DBB1A; Sat, 9 Mar 2013 16:07:43 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Subject: Re: how to forbid a process to use swap? From: Ben Cottrell In-Reply-To: <201303092355.r29NtRX4015510@mech-cluster241.men.bris.ac.uk> Date: Sat, 9 Mar 2013 16:07:41 -0800 Content-Transfer-Encoding: 7bit Message-Id: <4E64D344-5552-444B-B915-A0773A848379@wolfhut.org> References: <201303092355.r29NtRX4015510@mech-cluster241.men.bris.ac.uk> To: mexas@bristol.ac.uk X-Mailer: Apple Mail (2.1499) Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Mar 2013 00:07:49 -0000 On Mar 9, 2013, at 15:55, Anton Shterenlikht wrote: > I run a program that uses large arrays. > I don't want it to use swap, because it's > too slow. I want the program to fail when > there's not enough RAM, rather than using > swap. How to do this? If it were me I would start with mlockall() and work from there... do you have source code to the program in question? You could also play with resource limits, just from the shell (ulimit in sh, limit in csh) -- but that's less of an exact science, since you don't *know* for sure how much memory the process will be able to use before swap starts being used. ~Ben