Version française
Home     About     Download     Resources     Contact us    
Browse thread
Memory allocation nano-benchmark.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Guillaume <guillaume@t...>
Subject: Re: [Caml-list] Memory allocation nano-benchmark.
On Fri, Feb 11, 2005 at 12:28:57PM +0100, Oliver Bandel wrote :
> On Fri, Feb 11, 2005 at 12:04:20PM +1100, skaller wrote:
> > On Fri, 2005-02-11 at 03:50, Marwan Burelle wrote:
> > > On Thu, 10 Feb 2005 09:59:53 -0500, John Prevost <j.prevost@gmail.com> wrote:
> > > > In a program that allocates one very large chunk of memory, 
> > 
> > > It also depends on malloc, on Linux it sometimes works
> > > "optimisticaly", that is, it won't realy allocate memory unless you
> > > use it
> 
> You can call calloc() instead of malloc, so you automatically
> use the memory.

IIRC, calloc() does not always write the memory it allocates. If it
allocates one little chunk of memory, it uses sbrk() + memset().
But on large ones, it uses mmap(), which do not write memory until a
pagefault.

> 
> Ciao,
>    Oliver

Guillaume Leconte

-- 
You're not a beautiful and unique snowflake.