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.

Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 10, 2021, 12:43 AM EDT
James Williams22 reputationPosted Oct 11, 2021, 10:33 AM EDT
Srinivasan RamamoorthiRank #877 · 2.5K reputationPosted Oct 11, 2021, 1:58 PM EDT
Can you try disposing the objects after calling the process?