James Williams

James Williams

  • NA
  • 21
  • 565

Running multiple processes

Oct 9 2021 5:47 PM

I have a program that monitors for new text files being saved in a folder. When it finds the file it reads it, writes the data to a SQL table, does some updates, then calls another program to print a report.

Then it waits for the next file.

Here is a copy of the code

System.Diagnostics.Process LOProc = new System.Diagnostics.Process();
                    LOProc.StartInfo.FileName = PSParmServicePGM;
                    LOProc.StartInfo.Arguments = PSGUID;
                    LOProc.Start();

After about a week the server becomes unresposive, I am assuming it is a memory issue. If I log out and back in and start my program is works for another week, then I have to do the same thing over again.

I ran processmon and I do not see the 2nd program getting stuck.

What is the proper way to call a 2nd program but not tie up the calling program waiting for the 2nd program to finish.

 


Answers (3)