Wed, 29 Feb 2012 09:35:09 +0000 Comments to “Debugging memory in OCaml: any advice?” Paolo Donadeo's personal Internet site and blog https://www.donadeo.net/post/2012/debugging-memory-in-ocaml-any-advice p.donadeo@gmail.com (Paolo Donadeo) By: Didier Le Botlan https://www.donadeo.net/post/2012/debugging-memory-in-ocaml-any-advice#comment-1789 https://www.donadeo.net/post/2012/debugging-memory-in-ocaml-any-advice#comment-1789 Wed, 29 Feb 2012 09:35:09 +0000 Didier Le Botlan <div><p>To begin with, you could use GC stat functions to frequently get GC status, in particular the number of "live_words" (x8, assuming 64 bit platform, gives you the amount of live data managed by the GC). Note that some data, such as Bigarrays, are not taken into account here.</p><p>By the way, check that the GC is not disabled (by setting its verbosity level and checking that major collections do happen).</p><p>At this point, assuming the GC is enabled, I see two cases :</p><p> 1 - Most of the used memory is outside the GC. This is tough, you will have to find out what allocates memory outside the caml heap (could be bigarrays).</p><p> 2 - Most of the used memory is managed by the GC. Then, you can use tools such as ocamlviz to identify what takes most of the memory. </p><p>All this requires access to the source code and recompilation.</p></div>