Thursday, 20 December 2007

Measuring memory usage in OCaml

Dimitry Grebeniuk has kindly released his objsize library. This simple C library allows you to compute the size in bytes and depth of any OCaml value.

The ability to compute the memory requirements of individual values in OCaml programs is a step towards full memory profiling and can be extremely useful in a variety of circumstances. Most notable, perhaps, is the utility of memory profiling when hunting down memory leaks, e.g. caused by unbounded memoization. This library should be in the arsenal of any self-respecting OCaml programmer.

No comments: