Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Weak pointers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Kohler Markus <kohlerm@b...>
Subject: Re: Weak pointers
> >The problem is that if you delete an element in the tree it may be that the 
> >hash table still points to the node, because there was no garbage collection 
> >yet. It could be possible that you would still find the entry trough the hash 
> >table.
> 
> I don't see a problem here.  You find the entry and use it instead of
> allocating a new node.  This is a rather good thing.  It means you
> avoid allocating, and leave less garbage for the GC to collect.
> 

But how do you know then that value is not valid anymore ?
I you use a flag to indicate that then I don't see an advantage of using a 
weak pointer. 
The same could be done with a "normal" pointer. 

Markus
  



 

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