문제

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?

도움이 되었습니까?

해결책

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

You should read a bit on leases and sponsorships.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top