Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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
-- 
+-----------------------------------------------------------+
  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