From owner-freebsd-current@FreeBSD.ORG Thu Nov 24 17:38:22 2011 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 303111065673; Thu, 24 Nov 2011 17:38:22 +0000 (UTC) (envelope-from maxim@freebsd.org) Received: from mp2.macomnet.net (ipv6.irc.int.ru [IPv6:2a02:28:1:2::1b:2]) by mx1.freebsd.org (Postfix) with ESMTP id 7730C8FC08; Thu, 24 Nov 2011 17:38:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mp2.macomnet.net (8.14.5/8.14.5) with ESMTP id pAOHcJcJ018757; Thu, 24 Nov 2011 21:38:19 +0400 (MSK) (envelope-from maxim@freebsd.org) Date: Thu, 24 Nov 2011 21:38:19 +0400 (MSK) From: Maxim Konovalov To: Kostik Belousov In-Reply-To: Message-ID: References: <20111122124410.GP50300@deviant.kiev.zoral.com.ua> <20111122154357.GI95664@mdounin.ru> <20111122154935.GR50300@deviant.kiev.zoral.com.ua> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: arch@freebsd.org, current@freebsd.org, igor@sysoev.ru, Maxim Dounin Subject: Re: RLIMIT_DATA and malloc(3) use of mmap(2) 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: Thu, 24 Nov 2011 17:38:22 -0000 Hi Kostik, On Wed, 23 Nov 2011, 11:22+0400, Maxim Konovalov wrote: > [...] > > Anyway, the patch needs testers before I will push it forward. > > > [igor's email was corrected] > > We will test it in out environment and let you know. > It seems I don't understand how it works. Here is a test program: http://maxim.int.ru/stuff/malloc_test.c.txt It allocates successfully 64x1MB chunks by malloc(), reallocf() and realloc() with the following command line: MALLOC_OPTIONS=JM limits -d 10m ./malloc_test When we add L flag to the MALLOC_OPTIONS it starts to work strange: It allocates 64MB via malloc() but fails to allocate more than 3MB by realloc() and reallocf(). More funny, the result varies from time to time: $ MALLOC_OPTIONS=JML limits -d 10m ./malloc_test | head RLIMIT_DATA: rlim_cur is 10485760, rlim_max is 10485760 1th allocation failed 2th allocation failed 3th allocation failed 4th allocation failed 5th allocation failed 6th allocation failed 7th allocation failed 8th allocation failed 9th allocation failed $ MALLOC_OPTIONS=JML limits -d 10m ./malloc_test | head RLIMIT_DATA: rlim_cur is 10485760, rlim_max is 10485760 1048576 bytes successfuly allocated 2097152 bytes successfuly allocated 3145728 bytes successfuly allocated 4194304 bytes successfuly allocated 5242880 bytes successfuly allocated 6291456 bytes successfuly allocated 7340032 bytes successfuly allocated 8388608 bytes successfuly allocated 9437184 bytes successfuly allocated $ MALLOC_OPTIONS=JML limits -d 10m ./malloc_test | head RLIMIT_DATA: rlim_cur is 10485760, rlim_max is 10485760 1th allocation failed 2th allocation failed 3th allocation failed 4th allocation failed 5th allocation failed 6th allocation failed 7th allocation failed 8th allocation failed 9th allocation failed It's today -current with your patch. -- Maxim Konovalov