Thursday, April 8, 2010

QTP - Available physical memory.

QTP - Available physical memory.

If your framework or test is getting executed for more than one hour, it would be better to monitor the available physical memory. This will help us to detect memory leak.

It is a good practice to destroy objects after associated task got completed.

Attaching function that capture available physical memory. I have used function funMessages(sMessages) that would take care of all the messages and print in the log file automatically or we can use print sMessages statement.

Function funAvailablePhysicalMemory()
        set colOS = goWMIService.InstancesOf("Win32_OperatingSystem")
        for each objOS in colOS
               sMessages =  "Available Physical Memory: " & _
                             round(objOS.FreePhysicalMemory / 1024) & " MB"
        next
        Call funMessages(sMessages)      
        set colOS = Nothing
End Function 
 



----

No comments:

Post a Comment