English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
OCaml runtime using too much memory in 64-bit Linux
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-14 (16:36)
From: Brian Hurt <bhurt@j...>
Subject: Re: [Caml-list] Re: OCaml runtime using too much memory in 64-bit Linux
Stefan Monnier wrote:

>How about allocating this array of bytes via mmap and then leave it
>uninitialized (relying on POSIX's guarantee that it's already
>initialized to zeros)?
>This way you can easily have a 4GB "dense" table which doesn't use much
>RAM since most of the 4GB will be mapped (via copy-on-write) to the same
>"zero page".
Even on a system like linux, which optimistically allocates memory (i.e. 
the actually underlying memory isn't allocated until you actually touch 
it), once you read the page, it has to actually exist in memory.  Even 
using 1 byte per 4M page, mapping a whole 64-bit memory space requires 4 
TB of ram.  And many systems do not optimistically allocate memory, as 
it causes a lot of problems (for example, allocations can return false 
positives, which then segfault when you first touch the memory because 
it can't really be allocated).