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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dr. Thomas Fischbacher <t.fischbacher@s...>
Subject: Memory statistics tool

Dear OCaml folks,

when building large applications that work on complicated and highly
networked data, one issue that easily comes up is to get some idea
about what chunks of data eat all your memory. Now, it would be
marvellous for data structure optimization purposes if there were a
function

memory_footprint: 'a -> int64 (or maybe float),

which takes as argument a root
(e.g. Obj.magic [|Obj.magic firstthingy; Obj.magic secondthingy;
       Obj.magic thirdthingy|])
and tells me how many cells are occupied by those ML data structures
reachable from that root. Basically, this would correspond to using
the GC's traversal mechanism and doing some internal statistics at the
same time. My guess would be that the Marshal module "almost" has such
a function already, to determine the amount of memory required to hold
a string-serialized value. But as these values get compacted, the length
of the string does not correspond to the number of words occupied by the
in-memory data.

Is there already something like that? Has anyone already built such
a tool?

-- 
best regards,
Thomas Fischbacher
t.fischbacher@soton.ac.uk