Browse thread
Questions on replacing finalizers and memory footprints
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jon Harrop <jon@f...> |
| Subject: | Re: [Caml-list] Questions on replacing finalizers and memory footprints |
On Friday 07 December 2007 10:44, Jean-Christophe Filliātre wrote: > Xavier Leroy wrote: > >> Also, is there a simple way to implement a function (perhaps using > >> Obj.magic) which will walk a (possibly circular) network of tuples, > >> arrays, variadic entities and lists, and return the total number of > >> bytes used up by that structure? I see that this should be possible > >> in principle with the present implementation of the runtime if one > >> could get some basic information about the internal type of an > >> array. > > > > Jean-Christophe Filliātre's "size" library does exactly this: > > > > http://www.lri.fr/~filliatr/software.en.html > > Indeed. However, note that it uses internally a hash table to store > blocks already considered (in order to correctly account for sharing), > and thus it is potentially incorrect if the GC moves some blocks during > the count, for instance during a resizing of the hash table (which > triggers the GC). I don't know how to avoid this issue; any help is > welcome. Yes. I wanted this functionality as well and tried your "size" library but it only segfaults on my machine. Presumably this must be written in C to avoid using the GC? Perhaps this would be a good product... :-) -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/products/?e