I am having a C# 2010 windows application call another C# 2008 windows application with the following code:
String Process_Arguments = null;
eRPT_Process.StartInfo.UseShellExecute = false;
eRPT_Process.StartInfo.FileName = strConsoleAppLocation;
Process_Arguments = strEncryptedValue + " " + strWebServiceurl + " 1 try";
eRPT_Process.StartInfo.Arguments = Process_Arguments;
eRPT_Process.Start();
eRPT_Process.WaitForExit(1800);
Process_Arguments = null;
My question is the following line of code:
eRPT_Process.WaitForExit(1800);
If this program does not wait for the other program to finish executing, could this make the second program stay in memory for awhile?
Basically the first program calls the second program in a loop. Thus could a thread from the previous call to the second program be running at the same time that another call to the second program is running? If so, could these cause the second program to have a memory leak?
if so how would you solve this problem?
Loading
VulpesPosted Feb 8, 2013, 6:29 AM
You can use the System.Diagnostics.StopWatch class for this:
http://msdn.microsoft.com/en-gb/library/system.diagnostics.stopwatch(VS.100).aspx
I'd then use the longest run time plus a margin (depending on the dispersion of the results) of at least 20%.
2. There are some resources (such as databases) where creating multiple simultaneous connections is not usually a problem. Similarly, web services can generally deal with multiple simultaneous client requests.
However, other resources such as files can give you problems if multiple applications are trying to access them at the same time and, even if a file allows shared access, it may not be safe for multiple applications to be changing it concurrently i.e. it may not give the results you expect.
You really need to consider each resource on its merits as there are no hard and fast rules on this.
Sie StePosted Feb 8, 2013, 12:56 AM
1. How long of a time delay would you use? The second application was not setup to have more than one thread running at a time.
2. For your comment, "
VulpesPosted Feb 7, 2013, 5:36 PM