Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Weak pointers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1997-03-20 (14:36)
From: Emmanuel Engel <Emmanuel.Engel@l...>
Subject: Weak pointers
I wonder when Weaks pointers are erased by the GC. As soon
as it can be or when there is no more memory ? 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 ?

Something like 

type ('a,'b) cache =             (* In fact a binary tree *)
    Node of 'a * 'b * ('a,'b)cache Weak.t

and to use the usual fonctions over binary tree.


- Emmanuel Engel