From: Hendrik Tews <tews@cs.ru.nl>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Questions on replacing finalizers and memory footprints
Date: Wed, 23 Jan 2008 13:08:09 +0100 [thread overview]
Message-ID: <wwuve5k7niu.fsf@tandem.cs.ru.nl> (raw)
In-Reply-To: <4759241C.4070202@lri.fr> (Jean-Christophe =?iso-8859-1?Q?Fil?= =?iso-8859-1?Q?li=E2tre's?= message of "Fri, 07 Dec 2007 11:44:44 +0100")
Jean-Christophe Filliâtre <Jean-Christophe.Filliatre@lri.fr>
writes:
> 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.
Use the normal hash function (ie. the hash depends on the block
and not on its address) and use the blocks themselves as keys!
Then the GC will not change the hash and will update the keys in
the hash table. Of course all in a hash table with physical
equality. I use this solution in memcheck
(http://www.cs.ru.nl/~tews/memcheck/).
The problem is that your runtime will be quadratic in the number
of blocks that are equal (=) but different (not ==). For my
applications of memcheck this is problematic, because the data
contains lots of (ref None) blocks, which cannot be identified
for obvious reasons.
The (apparently abondoned) ocaml-ty branch
(http://www.pps.jussieu.fr/~henry/marshal/) uses a list instead
of a hash table and is therefore quadratic in _all_ blocks. The
performence is only sufficient for toy applications (4 hours for
checking 4MB).
For applications like size or memcheck it would be nice if the GC
could notify the program when it moves blocks.
Bye,
Hendrik
(Better answering late than never...)
next prev parent reply other threads:[~2008-01-23 12:08 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-06 11:12 Thomas Fischbacher
2007-12-06 12:51 ` [Caml-list] " dmitry grebeniuk
2007-12-06 14:26 ` Richard Jones
2007-12-06 14:57 ` Thomas Fischbacher
2007-12-06 16:50 ` Jon Harrop
2007-12-06 21:33 ` forum
2007-12-07 8:52 ` Xavier Leroy
2007-12-07 10:44 ` Jean-Christophe Filliâtre
2007-12-07 10:35 ` Jon Harrop
2007-12-07 11:18 ` forum
2007-12-07 19:54 ` Jean-Christophe Filliâtre
2007-12-07 21:01 ` forum
2007-12-08 9:57 ` Alexandre Pilkiewicz
2007-12-08 14:20 ` Benjamin Canou
2007-12-07 20:31 ` Christophe Raffalli
2008-01-23 12:08 ` Hendrik Tews [this message]
2007-12-07 11:31 ` Berke Durak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=wwuve5k7niu.fsf@tandem.cs.ru.nl \
--to=tews@cs.ru.nl \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox