From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 3 13:34:07 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4A91437B401 for ; Thu, 3 Apr 2003 13:34:07 -0800 (PST) Received: from mail.redlinenetworks.com (mail.redlinenetworks.com [216.136.145.172]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBC9B43FBF for ; Thu, 3 Apr 2003 13:34:06 -0800 (PST) (envelope-from sreekanth@redlinenetworks.com) Received: from SREELAPTOP (dhcp-174.redlinenetworks.com [192.168.40.174]) h33LY6w00511 for ; Thu, 3 Apr 2003 13:34:06 -0800 (PST) (envelope-from sreekanth@redlinenetworks.com) From: "Sreekanth" To: Date: Thu, 3 Apr 2003 13:34:07 -0800 Message-ID: <000001c2fa28$c1cfc490$ae28a8c0@SREELAPTOP> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Subject: Mmap and malloc X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Apr 2003 21:34:07 -0000 Hi, I have a situation i am not sure i understand.I am running a 4.6.2 FreeBSD system with a Dual Xeon board with 2GB of Physical memory.I have a test program which continuoulsy calls mmap(with larger size each time) till it receives MAP_FAILED return value. I then call malloc(with bigger memory size each time) continuosly till it fails.Here are my results. Max mem mapped = 714 MB Max mem alloc = 308 MB My MAXDMSIZ is 1200*1024*1024 and KVA_PAGE is 512 (2GB) If i swap the order in wich mmap and malloc are called, then i get the following result. Max mem alloc = 1200MB Max mem mapped = 711MB My questions are as follows 1) Why is the difference between two approaches. ? 2) What exactly is the relationship between mmap malloc and KVA_PAGES. 3) I found that the Maximum mmapped memory = 4GB - KVA_PAGES*PAGE_SIZE - MAXDSIZ - 134 What is the 134 value..? It is very consistent for me for various values of KVA_PAGES and MAXDSIZ, so i am ruling it being just a coincidence. I hope somebody has already seen this kind of behaviour and therefore can help me out.. Thanks in advance, Sreekanth ps: If somebody needs the code i used to generate these results, i would be more than happy to provide it.