From owner-freebsd-current@FreeBSD.ORG Tue Feb 19 15:34:37 2008 Return-Path: Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9D4F16A417 for ; Tue, 19 Feb 2008 15:34:37 +0000 (UTC) (envelope-from is@rambler-co.ru) Received: from relay0.rambler.ru (relay0.rambler.ru [81.19.66.187]) by mx1.freebsd.org (Postfix) with ESMTP id 744B013C4E9 for ; Tue, 19 Feb 2008 15:34:37 +0000 (UTC) (envelope-from is@rambler-co.ru) Received: from localhost (is1.park.rambler.ru [81.19.64.121]) by relay0.rambler.ru (Postfix) with ESMTP id 4437B5E49 for ; Tue, 19 Feb 2008 18:18:11 +0300 (MSK) Date: Tue, 19 Feb 2008 18:18:10 +0300 From: Igor Sysoev To: freebsd-current@FreeBSD.ORG Message-ID: <20080219151809.GF57366@rambler-co.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Subject: malloc(3) ignores RLIMIT_DATA X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2008 15:34:37 -0000 malloc(3) in FreeBSD 7 uses mmap() (then sbrk() on 32-bit platform) and ignores RLIMIT_DATA. FreeBSD 8's malloc() can be configured to use sbrk() only ("Dm"), but default setting is "DM". Instead of gracefully handling ENOMEM condition processes grows and swaps out, causing livelock. Using RLIMIT_AS (aka RLIMIT_VMEM) as suggested interacts badly with stack growth in process low memory condition. As sbrk() is less preferable because of framentation and race conditions, why not to create mmap() flag MMAP_DSS to check RLIMIT_DATA and to use it in malloc(3) ? -- Igor Sysoev http://sysoev.ru/en/