|
 |
On 3/14/2012 9:14 AM, clipka wrote:
>> And btw, cyclic references are not the only problematic situation with
>> reference counting. There are cases where objects may be deleted too
>> early,
>> while there's still code using them.
>
> I can't think of any reason why that could possibly happen, provided
> that the reference counting is implemented in a thread-safe manner.
Imagine you've implemented a tree where each node is an object which has
a "delete" method that removes the node from the tree. If you're not
careful the node could end up removing all references-counted pointers
to itself (since "this" isn't reference counted) and be reclaimed while
still running its own delete method.
Post a reply to this message
|
 |