From: vanicat@debian.org (Rémi Vanicat)
To: caml-list@inria.fr
Subject: Re: understanding weak
Date: Fri, 31 Oct 2008 09:33:38 +0100 [thread overview]
Message-ID: <87bpx1mae5.dlv@maison.homelinux.org> (raw)
In-Reply-To: <490A3DF9.5010700@frisch.fr>
Alain Frisch <alain@frisch.fr> writes:
> Warren Harris wrote:
>> On Oct 30, 2008, at 11:48 AM, CUOQ Pascal - Pascal.CUOQ@cea.fr wrote:
>>> In short: don't use weak pointers to make caches.
>>
>> Thanks for the advice -- but I thought this was exactly what weak
>> hash tables were intended for.
>
> Although there is some similarity between a weak table and a cache
> ("store values, but feel free to get rid of them"), they are really
> different beasts: a good implementation of a weak table should release
> memory as soon as possible to avoid memory leak; a good implementation
> of a cache should instead keep data as long as possible (until there
> is a good reason to release it, like resource exhaustion).
It's true, but it could be interesting to have a cache pointer/cache
table provided with the garbage collector: it's the GC that know when
there is not enough memory left, and that it should free those cache
pointer to have some.
--
Rémi Vanicat
next prev parent reply other threads:[~2008-10-31 8:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20081030182019.EEBC5BBB7@yquem.inria.fr>
2008-10-30 18:48 ` CUOQ Pascal
2008-10-30 19:12 ` [Caml-list] " Daniel Bünzli
2008-10-30 19:35 ` Warren Harris
2008-10-30 23:06 ` Alain Frisch
2008-10-31 8:33 ` Rémi Vanicat [this message]
2008-11-01 1:08 ` Jon Harrop
2008-11-01 10:37 ` Stefano Zacchiroli
2008-11-01 15:18 ` kirillkh
2008-10-30 18:19 Warren Harris
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=87bpx1mae5.dlv@maison.homelinux.org \
--to=vanicat@debian.org \
--cc=caml-list@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