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

  • SEARCH
  • Home
  • 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 271469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:10:04+00:00 2026-05-12T00:10:04+00:00

I am playing with the .net remoting features and there is something that I

  • 0

I am playing with the .net remoting features and there is something that I can’t figure out nor find an answer in Google and is how the object disposal works.

I try to implement some kind of object pooling with remoting, for that I’ve list of static objects that are basicly a string and boolean state indicator.

When I request for a new remote object,(durring the consturctor) I check the pool for a free one, mark it as in-use and during the destruct of the object. the DismisObject simply marks it as “free”,

  public class MyRemotableObject : MarshalByRefObject,IDisposable
{

    private AdvancedString obj;
    public MyRemotableObject()
    {
        aso = strCache.GetFreeObject();
    }
    ~MyRemotableObject()
    {
        Destroy();
    }
    public void Dispose()
    {
        Destroy();
    }
    public void SetMessage(string message)
    {
        if (obj== null) { obj= strCache.GetFreeObject(); }
        obj.str= message;
    }
    public string GetMessage()
    {
        return obj.str;          
    }
    void Destroy()
    {
        if (obj!= null)
        {
            obj.DismisObject();
            obj = null;
        }
    }
}

The timeouts work fine – after 5 minutes of now activity when I try to use the object I got remoting exception but ~MyRemotableObject() not the Dispose() functions aren’t called so the object is never marked as free in the pool. Even if I close the program – still the object remains active in the pool. The only way to free it is manually call the Dispose function (which I can’t do if, for example the program crashes or the user leaves is open )

Is there a way to force .net to dispose/destruct the objects when it closes the connection?
(I found in some place that the CG should do that once in a while, so I opened 4 clients and crashed 2 them – the other 2 got disconnected after a while but the objcets are still marked as active)

  • 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-12T00:10:05+00:00Added an answer on May 12, 2026 at 12:10 am

    You could possibly use ITrackingHandler to track when your object is disconnected and then run the Dispose code at that point.

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

Sidebar

Related Questions

I've been playing with ASP.NET MVC and ran into something I can't figure out.
Playing around with MongoDB and NoRM in .NET. Thing that confused me - there
I am playing with ASP.NET MVC and I see that there are a few
I've been playing with ADO.NET Entity Framework lately, and I find that it suits
I'm playing around with a composite control that uses the ASP.NET templating system. I
I was playing around with .Net reflector today and realized that Miicrosoft's entire Expression
I've been playing around with .NET SpeechSynthesizer lately. and I've got a method that
Just playing around with some of the APIs in .NET and I can't seem
I have a .NET 2.0 remoting application that needs to communicate between machines that
I am playing around with the ASP.NET MVC Html.Helpers and I noticed that say

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.