observing a reference variable's instance

  • Thread starter Thread starter Pieter Breed
  • Start date Start date
P

Pieter Breed

Hi,

I would like to have a reference to class instance, but not influence
when it should or should not be garbage collected. Is this possible?

I have a cache of objects that I use to send update signals with. The
cache manager should allow these instances to go out of scope and be
garbage collected, in other code. Normally the cache's reference to
the instance will prevent that instance from being collected. Is there
a way around this?

Regards,
Pieter
 
Pieter,
I would like to have a reference to class instance, but not influence
when it should or should not be garbage collected. Is this possible?

Use the WeakReference class.


Mattias
 
Back
Top