Forum Discussion
I know this is an old thread, but I'm experiencing the exact same issue when working with processes.
I'm using testcomplete 11, lastest update.
The function .MemUsage used to work very well, and for some reason, without any update, and not even closing the TestComplete window, it started to wait 15s for each process.
Testcomplete will wait as long as the "auto-wait timeout" setting you've specified into your project settings.
The only workaround I've managed to find is to use "Options.Run.Timeout = 100" before checking processes, and to set it back to default after checking processes.
I've seen the same problem with Sys.Process(ProcessName).Exists, and "solved" it the same way...
- tristaanogre7 years agoEsteemed Contributor
Generally speaking, if you want to get MemUsage of a process and you're not certain the process exists before you do so... or, for that matter, you want to check to see if the process exists before you do soemthing with it, the Best Practice method is to use the WaitProcess method.
So... let's say i want to get MemUsage of app1. HEre's how I'd write it in JavaScript
function checkMemUsage(processName){ var processObject; processObject = Sys.WaitProcess(processName, 20000); //waits for the process up to 20 seconds if (!processObject.Exists){ Log.Error('Process ' + processName + ' is not memory resident');
return -1; } else { return processObject.MemUsage; } }
function test(){
var appMemoryUsage;
appMemoryUsage = checkMemUsage('app1');
if (appMemoryUsage == -1){
Log.Error('Unable to retrieve memory usage for app1');
}
else{
Log.Message('Memory usage for app 1: ' + appMemoryUsage);
}
}- GGuezet7 years agoContributor
In my case I know that the process exists, because i've done an if Sys.WaitProcess("My_Process",10000).Exists then before, and it still "wait for process" on the .MemUsage line.
Related Content
- 11 months ago