From owner-freebsd-questions Sun Jan 28 1:35:17 2001 Delivered-To: freebsd-questions@freebsd.org Received: from cwnt.com (unknown [192.116.246.129]) by hub.freebsd.org (Postfix) with ESMTP id ACA2337B69B for ; Sun, 28 Jan 2001 01:34:59 -0800 (PST) Received: from KOBI ([192.168.0.219]) by cwnt.com with Microsoft SMTPSVC(5.0.2195.1600); Sun, 28 Jan 2001 11:34:57 +0200 From: "Kobi Luz" To: Subject: regarding use of mmap against brk in malloc Date: Sun, 28 Jan 2001 11:36:40 +0200 Message-ID: <001501c0890d$d1e65fd0$db00a8c0@KOBI> MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1255" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal X-OriginalArrivalTime: 28 Jan 2001 09:34:57.0790 (UTC) FILETIME=[940E01E0:01C0890D] Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi. The current implementation of malloc, uses brk() and sbrk() to allocate new pages from the OS. As the allocated pages are successive, pages are returned to the OS only when the last page is free, which often does not happen. This creates a situation where almost no memory is returned to the OS even after being freed by the process. We want to use calls to mmap() instead of brk() to address this problem. Is there any reasons we should know about why we should not use only calls to mmap(), and not use calls to brk() at all in the implementation of malloc? Are there any advantages for brk() over mmap() (like performance issues) that we should know about, or any problems with the use of mmap() in malloc? Thanks a lot, Kobi Luz. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message