Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write memory usage log in ASP.NET

Tags:

c#

asp.net

We got "out of memory" issue on production servers. What API can we use to get live memory (physical and managed) usage of the ASP.NET application?

Thanks.

PS: we're forbidden to profile memory with tools.

like image 910
Ricky Avatar asked Feb 21 '26 01:02

Ricky


2 Answers

Also an Out of memory doesn't necessarily mean what you think. heavy memory fragmentation due to excessive object creation can be reported as out of memory since the GC is not able to find a continuous block of memory large enough for next (or last attempted) allocation.

like image 101
Shiv Kumar Avatar answered Feb 23 '26 17:02

Shiv Kumar


.Net performance counters can help you with a number of managed memory related stats.

This page details some of the ones available- http://msdn.microsoft.com/en-us/library/x2tyfybc.aspx

You can use normal windows memory counters to get an overview of non-managed memory- http://msdn.microsoft.com/en-us/library/aa965225(VS.85).aspx

like image 29
WiseGuyEh Avatar answered Feb 23 '26 15:02

WiseGuyEh