Is there an analogue of AllocMemSize in C# ?

how to get the total amount of used memory?

Page 1 of 1

3 Replies - 425 Views - Last Post: 18 December 2010 - 02:53 AM Rate Topic: -----

#1 Ilya_Sh  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 14-December 10

Is there an analogue of AllocMemSize in C# ?

Posted 17 December 2010 - 06:40 PM

Dear Collegues,

How to get the total amount of memory, used in the current application?
E.g., in Delphi (and, as far as I know, in C++), it was accessible via the global variable AllocMemSize. I was failed to find an analogue in C#...
Is This A Good Question/Topic? 0
  • +

Replies To: Is there an analogue of AllocMemSize in C# ?

#2 Renagado  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 115
  • View blog
  • Posts: 388
  • Joined: 14-June 09

Re: Is there an analogue of AllocMemSize in C# ?

Posted 17 December 2010 - 07:03 PM

I think your best bet is getting it through System.Diagnostics.Process.

For example something like this:
Process currentProc = Process.GetCurrentProcess();
long memoryUsed = currentProc.PrivateMemorySize64;


Hope this helps :)
Was This Post Helpful? 3
  • +
  • -

#3 Ilya_Sh  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 4
  • Joined: 14-December 10

Re: Is there an analogue of AllocMemSize in C# ?

Posted 17 December 2010 - 08:36 PM

View PostRenagado, on 17 December 2010 - 06:03 PM, said:

...
Hope this helps :)


Yes, thank you!

Am I correct - the get method for the property PrivateMemorySize64 returns the same value, until process (currentProc in the above example) is not refreshed?
Was This Post Helpful? 1
  • +
  • -

#4 elbielefeld  Icon User is offline

  • D.I.C Head

Reputation: 70
  • View blog
  • Posts: 213
  • Joined: 18-May 10

Re: Is there an analogue of AllocMemSize in C# ?

Posted 18 December 2010 - 02:53 AM

Yes, you can use the Refresh() method of the Process class.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1