Pergunta

I am experimenting with cross-AppDomain objects, and found one quite strange thing.

When I call a remote method, which is allocating a MemoryStream object and returning it's reference (and which is immediately disposed by the caller), memory usage is quite significantly increasing and is not dropping down, even after calling GC.Collect().

On the calling method which returns new String or byte[] object every time, there is no leak.

The Memory profiler shows that most live objects are of type Char[] and String (in case of MemoryStream).

The question is - did I misunderstand something, and remote calls are not so simple as inheriting from MarshalByRefObject?

Foi útil?

Solução

Remote calls are as easy - but object lifetime and garbage collection are not as simple.

You should read a bit on leases and sponsorships.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top