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
Determining memory usage?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-14 (07:03)
From: Erik de Castro Lopo <ocaml-erikd@m...>
Subject: Re: [Caml-list] Determining memory usage?
On Sun, 13 Feb 2005 21:05:10 -0500
William Lovas <wlovas@stwing.upenn.edu> wrote:

> How about the strikingly appropriately named Sys.word_size? :)

Yep, thats a winner. Thanks.

For the archive, I now have:

   let x = Gc.stat () in
   printf "Memory used : %d kb\n\n" (x.heap_words / (1024 / (Sys.word_size / 8))) ;;

which gives what seems to be a sensible result.

  Erik de Castro Lopo  nospam@mega-nerd.com (Yes it's valid)
"The object-oriented model makes it easy to build up programs by
accretion. What this often means, in practice, is that it provides
a structured way to write spaghetti code." -- Paul Graham