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-07 (18:20)
From: Gerd Stolpmann <info@g...>
Subject: Re: [Caml-list] OCaml runtime using too much memory in 64-bit Linux
Am Mittwoch, den 07.11.2007, 12:28 -0500 schrieb Adam Chlipala:
> 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?

We are using O'Caml on 64 bit Linux, and aren't aware of such problems.

Did you observe a debug GC message that proves it? 200 MB means that an
address space of 200M * 4K = 8E is covered.

Also think of Linux modifications that do address randomization, i.e.
prevent that contiguous addresses are allocated.

Gerd Stolpmann * Viktoriastr. 45 * 64293 Darmstadt * Germany 
gerd@gerd-stolpmann.de          http://www.gerd-stolpmann.de
Phone: +49-6151-153855                  Fax: +49-6151-997714