From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 233DCBC6B for ; Wed, 7 Nov 2007 18:28:53 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAG6EMUfAXQImh2dsb2JhbACOfQIBCAop X-IronPort-AV: E=Sophos;i="4.21,385,1188770400"; d="scan'208";a="3999767" Received: from discorde.inria.fr ([192.93.2.38]) by mail2-smtp-roc.national.inria.fr with ESMTP; 07 Nov 2007 18:28:52 +0100 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id lA7HSqPv016204 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Wed, 7 Nov 2007 18:28:52 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ao8CAPaEMUdCm3xr/2dsb2JhbAA X-IronPort-AV: E=Sophos;i="4.21,385,1188770400"; d="scan'208";a="19041036" Received: from www.janestcapital.com (HELO smtp.janestcapital.com) ([66.155.124.107]) by mail4-smtp-sop.national.inria.fr with ESMTP; 07 Nov 2007 18:28:51 +0100 Received: from [172.25.135.136] [38.96.172.125] by janestcapital.com (SMTPD-9.10) id A5D20834; Wed, 07 Nov 2007 12:28:50 -0500 Message-ID: <4731F5D1.2070405@janestcapital.com> Date: Wed, 07 Nov 2007 12:28:49 -0500 From: Adam Chlipala User-Agent: Thunderbird 1.5.0.8 (X11/20061107) MIME-Version: 1.0 To: caml-list@inria.fr Subject: OCaml runtime using too much memory in 64-bit Linux Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IMAIL-SPAM-VALREVDNS: (f5d204290000560f) X-Miltered: at discorde with ID 4731F5D4.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 runtime:01 ocaml:01 runtime:01 malloc:01 defined:02 megabytes:02 overly:02 seems:03 macro:03 compiled:04 size:95 problem:05 problem:05 table:93 I've encountered a problem where certain OCaml programs use orders of magnitude more RAM when compiled/run in 64-bit Linux instead of 32-bit Linux. Some investigation led to the conclusion that the difference has to do with the size of OCaml page tables. (Here I mean the page tables maintained by the OCaml runtime system, not any OS stuff.) A program that should be using just a few megabytes of RAM ends up using 200+ MB to store a page table. It seems that a C macro is defined by default on 64-bit Linux to use mmap() instead of malloc(). Ironically, a comment says that this was done to avoid being given blocks of memory that are very far apart from each other, forcing the creation of overly large page tables. It's ironic because that is exactly the problem that is showing up now with mmap(). It ends up called twice for the program I'm looking at, and the two addresses it returns are far enough apart to lead to creation of a 200 MB page table. Has anyone else experienced this problem? Would the runtime system need to be changed to avoid it?