How to get the amount of memory used by an application?

Ask general questions here.
CharlesF
Posts: 5
Joined: Mon Aug 02, 2010 10:31 am

How to get the amount of memory used by an application?

Post by CharlesF » Wed Aug 04, 2010 2:09 pm

Hi folks,

During automated testing I want to log and report the memory used by the target application. Is there a way to do that?

Thanks in advance.
Charles

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: How to get the amount of memory used by an application?

Post by Support Team » Wed Aug 04, 2010 2:33 pm

Hi,

With Ranorex you have fully access to the .Net Framework. To get the memory of a specific process please use following code
System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName("firefox");
Console.WriteLine("Memory used: {0}.", proc[0].PrivateMemorySize.ToString());
Regards,
Peter
Ranorex Team