I have heard about marshal by reference, marshal by bleed and marshal by value. What exactly are the differences between these 3? I know that these are used when transporting data across appdomains/serialization but not much more.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The different forms of marshaling are used to describe how objects behave when they are passed between
AppDomaininstances via normal function calls. AnAppDomainis often known as a light weight process and provides an isolated container for managed objects to run in. Here’s a quick breakdown of the different typesMarshal By Reference
All types which derive from
MarshalByRefObjectwill marshal by reference. These object instances do not travel betweenAppDomaininstances. They are allocated in a specificAppDomainand do not leave it.When a reference to a
MarshalByRefObjectis passed across anAppDomainboundary a proxy is created in the targetAppDomain. This proxy can be used to manipulate the object in the originalAppDomainbut the object itself is not directly accessible.Marshal By Value
Essentially the opposite of
MarshalByRefObject. When these values are passed acrossAppDomainboundaries they are serialized via binary serialization and deserialized in the targetAppDomaininstance. The result is two, hopefully, independent values. One in each domain.Marshal By Bleed
Certain classes of types are known as Domain Neutral. In particular
string,Typeand other reflection members. These objects do not live in a particularAppDomainand references to them can be freely shared between them. They are similar to marshal by reference in that duplicates are not created but proxies are not created either. Instead the direct reference is shared betweenAppDomaininstances.You should take a look at Joe Duffy’s blog entry on the subject