Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3273268
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:54:51+00:00 2026-05-17T18:54:51+00:00

When you pass an object that inherits from MarshalByRefObject to a different AppDomain, won’t

  • 0

When you pass an object that inherits from MarshalByRefObject to a different AppDomain, won’t GC.Collect() induced by the AppDomain that created it collect the object, provided that the object is not rooted in either AppDomain by the time GC.Collect() called?

[When I say not rooted I mean no developer written code access it anymore.]

It appears that the object is not getting collected but rather getting promoted to the next generation!

But if I stop passing the object to a diff AppDomain, it is getting collected as expected.

Is this behavior by design? If so rationale?

Thanks guys,

P.S. I know GC.Collect() within code is bad for many reasons, I’m just trying to understand how GC would take place on MBROs.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:54:51+00:00Added an answer on May 17, 2026 at 6:54 pm

    As you mentioned MBRO objects are hard to keep track of for the gc. So MS implemented their behaviour a bit different.
    Those objects have two properties: Their initial lifetime (I think five minutes) and a RenewOnCallTime (two minutes). If a MBRO object is created it has it’s initial lifetime. Once this time is zero it is marked for gc.
    Every call on the object allows the object to live for RenewOnCallTime longer (if the remaining lifetime is less then the RenewOnCallTime).

    For an example (5 minutes initial lifetime, 2 minutes RenewOnCallTime):
    Object is created: Lifetime is five minutes;
    4 minutes pass; Lifetime is one minute;
    Call to object is made; Lifetime is two minutes;
    2 minutes pass;
    Object is marked for gc, No Lifetime left;

    Somewhere on MSDN there is a great article about this (which I can’t find right now :/)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example: I have an class that inherits from UIImageView. An object creates an instance
ok, ive a class and i pass an object as property. the object that
I'm trying to pass a complex object (that can be serialized, if that helps)
I'm creating a function where I need to pass an object so that it
I'm trying to pass a ViewData object from a master page to a view
I have a partial view that inherits from ViewUserControl<Guid?> - i.e. it's model is
C#: How do you pass an object in a function parameter? public void MyFunction(TextBox
Is it possible for a client to pass an RMI object as an argument
When I pass an immutable type object(String, Integer,.. ) as final to a method
How do I pass a form's TextBox object to the a method? The following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.