How can I check programmatically, how much memory my program currently has allocated ?
I need it for an ASP .NET app, but i suspect the solution is general for all types of .NET applications. Ideally, the operation to get the currently allocated amount of memory, should be fast, since I will need to query it often.
EDIT: Thanks for your answers. I will be using GC.GetTotalMemory for this task, since I need to use it for an ASP .NET application. After some experimenting, I have determined that it is fast and accurate enough for my needs. The suggestion to use Process' PrivateMemorySize64 property will also work in general; but as pointed out in the answers, for an ASP.NET application there will often be multiple AppDomain's running in one process. I need the memory total per-AppDomain.