From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q08J0tLF032590 for ; Sun, 8 Jan 2012 20:00:55 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAIjmCU9QRFuw/2dsb2JhbABDrEWBBYFyAQEFOj8QCxgcEhQoiDAGtHuFFYNigjdjBJUIkjo X-IronPort-AV: E=Sophos;i="4.71,476,1320620400"; d="scan'208";a="138328084" Received: from furbychan.cocan.org ([80.68.91.176]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/AES256-SHA; 08 Jan 2012 20:00:49 +0100 Received: from rich by furbychan.cocan.org with local (Exim 4.72) (envelope-from ) id 1Rjxz7-000835-7u; Sun, 08 Jan 2012 19:00:49 +0000 Date: Sun, 8 Jan 2012 19:00:49 +0000 From: "Richard W.M. Jones" To: orbitz@ezabel.com Cc: david.baelde@ens-lyon.org, Caml List Message-ID: <20120108190049.GB30498@annexia.org> References: <96F225D0-B458-4E25-BE34-3976989984B2@ezabel.com> <20120101124454.GA12851@annexia.org> <012932EC-860F-4A40-98D1-E4B6EC123927@ezabel.com> <20120108184505.GA30498@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120108184505.GA30498@annexia.org> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [Caml-list] Understanding usage by the runtime On Sun, Jan 08, 2012 at 06:45:05PM +0000, Richard W.M. Jones wrote: > And that brings us to (c): does it even make sense to give back memory > to the OS? I forgot to mention one way in which this is more efficient: If you munmap a piece of memory and later decide you need more memory so you call mmap, then the kernel has to give you zeroed memory. You probably didn't want zeroed memory, but you pay the penalty anyway. (The converse of this is that if your unused memory is swapped out, then it has to be written to disk and read back, which is even less efficient.) There is an madvise flag "MADV_DONTNEED" which is better than munmap + mmap, although not as optimal as it could be. See links below. http://gcc.gnu.org/ml/gcc-patches/2011-10/msg00733.html http://www.reddit.com/r/programming/comments/dp5up/implementations_for_many_highlevel_programming/c120n77 Probably the OCaml GC should be setting madvise hints anyway. While we're at it, the GC may be able to cooperate better with the new(-ish) Transparent Hugepages feature of Linux. I wonder if anyone has looked into these things to see if there are any quick wins to be had? Rich. -- Richard Jones Red Hat