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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:42:13+00:00 2026-05-31T19:42:13+00:00

I have a C# application which launches another executable using Process.Start() . 99% of

  • 0

I have a C# application which launches another executable using Process.Start().

99% of the time this call works perfectly fine. After the application has run for quite some time though, Process.Start() will fail with the error message:

Insufficient system resources exist to complete the requested service

Initially I thought this must have been due to a memory leak in my program – I’ve profiled it fairly extensively and it doesn’t appear there’s a leak – the memory footprint will still be reasonable even when this message failed.

Immediately after a failure like this, if I print some of the system statistics it appears that I have over 600MB of RAM free, plenty of space on disk, and the CPU usage is effectively at 0%.

Is there some other system resource I haven’t thought of? Am I running into a memory limit within the .NET VM?

Edit2:

I opened up the application in SysInternals Process Explorer and it looks like I’m leaking Handles left and right:

Handles Used: 11,950,352 (!)
GDI Handles: 26
USER Handles: 22

What’s strange here is that the Win32 side of handles seem very reasonable, but somehow my raw handle count has exploded waaaaay out of control. Any ideas what could cause a Handle leak like this? I was originally convinced it was Process.Start() but that would be USER handles, wouldn’t it?

Edit:

Here’s an example of how I’m creating the process:

var pInfo = new ProcessStartInfo(path, ClientStartArguments)
        {
            UseShellExecute = false,
            WorkingDirectory = workingDirectory
        };    
ClientProcess = Process.Start(pInfo);

Here’s an example of how I kill the same process (later in the program after I have interacted with the process):

Process[] clientProcesses = Process.GetProcessesByName(ClientProcessName);
if (clientProcesses.Length > 0)
{
     foreach (var clientProcess in clientProcesses.Where(
              clientProcess => clientProcess.HasExited == false))
     {
        clientProcess.Kill();
     }
}
  • 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-31T19:42:14+00:00Added an answer on May 31, 2026 at 7:42 pm

    The problem here is with retained process handles. As we can see from your later edits you are keeping a reference to the Process object returned by Process.Start(). As mentioned in the documentation of Process:

    Like many Windows resources, a process is also identified by its handle, which might not be unique on the computer. A handle is the generic term for an identifier of a resource. The operating system persists the process handle, which is accessed through the Handle property of the Process component, even when the process has exited. Thus, you can get the process’s administrative information, such as the ExitCode (usually either zero for success or a nonzero error code) and the ExitTime. Handles are an extremely valuable resource, so leaking handles is more virulent than leaking memory.

    I especially like the use of the word virulent. You need to dispose and release the reference to Process.

    Also check out this excellent question and it’s corresponding answer: Not enough memory or not enough handles?

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

Sidebar

Related Questions

I have a program app1 which launches another application using: app2Server := CreateOleObject('app2.Server'); On
I have an application which i build using gcc on linux host for ARM
I have an application that fires 2 threads, the 1st launches another class to
Possible Duplicate: .Net Process.Start default directory? I have a C# application, mono to be
I have an application which uses a SQL database. This is encapsulated by a
I have a simple application which was working fine until I added some code
We have an web application running under JBoss 5 which periodically launches a 'java'
I have an application which works with sockets and reads / writes data. It
I have two classes which extend Activity and need to call another class method
I have just written a Word Document creation web application using .NET 3.5 which

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.