Question

I have a theoretical question.

short:

Will a transparent proxy object be collected if the last reference to it is a WeakReference, but the real object is still referenced in the host process.

example:

The used example does not make sense but the real scenario is too complex to describe.

Assumed there is a cache realized with WeakReferences as described here: WeakReferenceExampleMSDN

Now the cache is filled with objects which lives in another process (Remoting). These objects are in the local process only transparent proxy objects and their lifetime is controlled by the other process.

If there is no magic i assume the proxy object gets collected, because the proxy object is only a handle to the real object. After the first run of the GC the cache is empty.

  • Is there some magic and this theoretical cache will work with remote objects?
Was it helpful?

Solution

The transparent proxy will be collected by GC. Therefore such a cache will not work for RemoteObjects

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top