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 6611121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:55:46+00:00 2026-05-25T19:55:46+00:00

I have a program that executes for 24 hours, then restarts. How can I

  • 0

I have a program that executes for 24 hours, then restarts.

How can I shift main() from into a separate application domain, which is torn down and refreshed every 24 hours, in order to completely eliminate any potential memory leaks?

  • 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-25T19:55:47+00:00Added an answer on May 25, 2026 at 7:55 pm

    You had me right up until you said:

    in order to completely eliminate any potential memory leaks?

    If you want to run code in another app domain then there are plenty of resources on how to do this, for example Executing Code in Another Application Domain (C# and Visual Basic). The basic principle is to create a class that inherits from MarshalByRefObject. You then create your new app domain and instruct it to create an instance of that object – this object is then your “entry point” into your app domain:

    AppDomain newAppDomain = AppDomain.CreateDomain("NewApplicationDomain");
    ProxyObject proxy = (ProxyObject)newAppDomain.CreateInstanceAndUnwrap("MyAssembly", "MyNamespace.MyProxy");
    

    However in C# there isn’t really any such thing as a “memory leak”, at best you just have objects which are inadvertantly kept in scope. If this is the case then an app domain is just overkill – all you really need to do is remove references to managed objects that are no longer needed and the Garbage Collector will tidy them up for you.

    If you have a true memory leak in unmanaged code an app domain won’t help you either. Unmanaged types aren’t bounded by app domains and so any unmanaged memory allocated “inside” the app domain won’t be freed when the app domain is destroyed. In this case you would be better off using separate processes instead.

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

Sidebar

Related Questions

I have a Java program that executes from Spring Qquartz every 20 seconds. Sometimes
I have a program that executes another program and the main program continues when
I have a Java program that executes specific commands into the OS. Am also
I have a program that uses the mt19937 random number generator from boost::random. I
I have a C# program that executes a thread. Inside this thread, I have
I have a program that executes various shell commands via system() and occasionally prints
I have a Java program that executes sh in interactive mode as a subprocess.
I have a program that checks the modification time of a file and executes
I have an application that executes workflows using WorkflowApplication as well as doing other
How do I check if another application is busy? I have a program that

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.