C# Starting multiple processes from a service
Hi all,
We are working on an application that starts and stops other applications, like a service watcher. We are using MS Visual Studio 2005 Professional and coding in C#.
Our application starts processors using System.Diagnostics.Process class and the Start() method, as per code snippet below.
This application runs as a Windows service, and starts always several instances of the same application, like multiples Windows Calculator for instance. We are experiencing difficulties starting processors after a certain number is reached.
We changed the application to work as a Console application and it could start an unlimited number of sub applications, but when used as a Windows Service, for some reason we can not create more instances when the limit number is reached. They start and stop without an exception (ExitCode = 0).
We collected statistics about computer committed charge, virtual memory used, available physical memory, and other numbers collected through TaskManager. We also worked with increasing the virtual memory size on the computer, and it didn't produce any changes regardless of the virtual memory used and the computer. We tested in computers with 1.5GB physical mem and 2GB physical mem; the first with 1GB and 2GB of VM and the second with 3GB and 4GB of virtual mem.
In all cases, the service application could only start 14 processes of the targeted application; the 15th instance starts, but gets shut down. We tried this on 3 different machines.
Is there a limit on the memory a service with its child threads can consume, or are we looking in the wrong direction?
Here is the code snippet:
Process meProc = new Process();
meProc.StartInfo.FileName = "app.exe";
meProc.StartInfo.Arguments = @"/args";
meProc.EnableRaisingEvents = true;
meProc.Start();
|