Re: Weak pointers

From: Kohler Markus (kohlerm@betze.bbn.hp.com)
Date: Thu Mar 20 1997 - 17:09:59 MET


Message-Id: <199703201609.RAA02977@betze.bbn.hp.com>
To: Emmanuel Engel <Emmanuel.Engel@lri.fr>
Subject: Re: Weak pointers
In-Reply-To: Emmanuel.Engel's message of Thu, 20 Mar 1997 13:12:16 +0100.
      <333129A0.6CFA@lri.fr>
Date: Thu, 20 Mar 1997 16:09:59 +0000
From: Kohler Markus <kohlerm@betze.bbn.hp.com>

> I wonder when Weaks pointers are erased by the GC. As soon
> as it can be or when there is no more memory ?

I can't speak for caml, but usally when there is no more memory, or the system
is idle.

> In the second
> case, does all the weaks pointers that can be erased are erased
> or just enough to allocate new memory. In this case, which are
> erased, the older or the younger ?
>
>
> Is it a good idea to use weak pointers to implement more
> or less a cache ?

 
IMHO not so a good idea.
1. Your replacement strategy for the cache will depend on internals of the
garbage collector.

2. Also it almost always makes sense to have a cache with a limited size.
 Therefore you have to implement a replacement strategy anyway.
On machines with virtual memory, the garbage collector ,may always "think"
that there's more memory left and prefer to grow the process instead of
reclaiming space.
Garbage collection in virtual memory can be VERY slow.

Markus

 

-- 
+----------------------------------------------------------------------------+
| Markus Kohler                          Hewlett-Packard GmbH                |
| Software Engineer                      Network & System Management Division| 
|                                        IT/E Success Team                   |
+----------------------------------------------------------------------------+



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:10 MET