Version française
Home     About     Download     Resources     Contact us    
Browse thread
memory usage
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] memory usage
On Mon, Jan 12, 2009 at 03:41:46PM +0800, John Lepikhin wrote:
> Please, give me some start point to find the roots of the problem.

Starting point should be to call this periodically:

      Gc.compact ();
      let stat = Gc.stat () in
      let live_words = stat.Gc.live_words in
      eprintf "live words %d\n%!" live_words;

which will tell you how many words (ie 4 or 8 byte chunks) are
reachable according to the garbage collector.

If this number is going up, then somewhere you are holding a pointer
to some object that you didn't expect to be live.

Rich.

-- 
Richard Jones
Red Hat