From owner-freebsd-questions@FreeBSD.ORG Mon Apr 18 20:29:25 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7206A16A4CE for ; Mon, 18 Apr 2005 20:29:25 +0000 (GMT) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2536843D41 for ; Mon, 18 Apr 2005 20:29:25 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from localhost (localhost [127.0.0.1]) by pi.codefab.com (Postfix) with ESMTP id 92D455CE7; Mon, 18 Apr 2005 16:29:24 -0400 (EDT) Received: from pi.codefab.com ([127.0.0.1]) by localhost (pi.codefab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 57568-07; Mon, 18 Apr 2005 16:29:23 -0400 (EDT) Received: from [192.168.1.3] (pool-68-161-53-96.ny325.east.verizon.net [68.161.53.96]) by pi.codefab.com (Postfix) with ESMTP id BB0C55C1E; Mon, 18 Apr 2005 16:29:23 -0400 (EDT) Message-ID: <42641891.3090205@mac.com> Date: Mon, 18 Apr 2005 16:29:05 -0400 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6) Gecko/20050319 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Grochowski References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at codefab.com cc: freebsd-questions@freebsd.org Subject: Re: Limiting process memory consumption with rsetlimit and limit. . . X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2005 20:29:25 -0000 David Grochowski wrote: > I'm currently working on a project where I need to limit the amount of > physical memory a process uses. I've tried the rsetlimit function and the > limit shell command to do so, but I have had no luck (though I was able to > limit the virtual memory and cause it to segfault). Neither seems to have > any effect on the physical memory available to the process. If anyone > could enlighten me on how to limit the physical memory available to a > process, it would be greatly appreciated. setrlimit(RLIMIT_RSS, ...) in C or something like: 8-sec# limit memoryuse 10 9-sec# limit cputime unlimited filesize unlimited datasize 500MB stacksize 64MB coredumpsize 100MB memoryuse 10MB memorylocked unlimited maxproc 256 descriptors 512 sockbufsize unlimited vmemorysize unlimited This is zsh, other shells may have slightly different syntax. In /bin/sh: "ulimit -Sm 10240"? -- -Chuck