Weak references – how useful are they?

Event handlers are a good use case for weak references. The object that fires events needs a reference to the objects to invoke event handlers on, but you typically don’t want the event producer’s reference holding to prevent the event consumers from being GC’d. Rather, you’d want the event producer to have a weak reference, and it would then be responsible for checking whether the referenced object was still present.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)