How to calculate / keep memory usage of .NET application on terminal servers?

I am making some kind of C # fat application on Citrix / Terminal Server.

How do you measure actual memory usage per session? What can I do to reduce overall memory usage?

We are still working on .NET 1.1. Does it matter if we update the .NET runtime?

+1


source to share


2 answers


It is very difficult to get metrics for real memory usage in .NET. The closest approximation you can get is provided for each object by calling Marshal.SizeOf (). My understanding of this method is that it essentially measures the size of the serialized version of an object, and the memory footprint may be close to that rather than accurate. But this is a good mark.

You can also explore SMS API under .NET. They provide ways to query various memory statistics from the Operating System about your process (or other processes). Its the same library that "perfmon" uses. You might be able to use this to programmatically test your process.



Also, you will want to invest in a good profiling tool for .NET. I appreciated ANTS and dotTrace. They are both very good. I preferred dotTrace for its simplicity. Most profilers have very unintuitive interfaces. This is what I expected. dotTrace is actually pretty good by these standards. ANTS, I think is probably more advanced (not sure, just my opinion from the brief eval I did on both of them).

+1


source


Here is an article from MSDN on Measuring Application Performance. It includes measuring measurements in memory.



I don't think updating the .NET Runtime will have a significant impact on your application as it will probably better optimize your application in other ways. Try to get rid of resources when you don't need them.

0


source







All Articles