Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Memory management for a .NET (wpf) application

An analysis of the performance of our application showed that the CPU usage was peaking at times when memory had to be allocated by the .NET memory management.

There was an (enormous) amount of memory just free but it was not claimed by the application, it searched for free space in its already claimed portion of memory.

Is it possible to configure an application to claim more memory when possible?
Is this perhaps related to the fact that the application is hosted under Citrix?

like image 588
Gerard Avatar asked Nov 10 '22 18:11

Gerard


1 Answers

Windows applications can't grow indefinitely, no matter how much free memory the system has.

You can read about the actual limits here: https://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx#memory_limits

And extra information about the issue here: http://www.codeproject.com/Articles/483475/Memory-Limits-in-a-NET-Process

If an application gets too close to its limit, it'll start spinning the Garbage Collector everytime it needs to claim new memory, to avoid running out of space and crashing with an OutOfMemoryException. This extra effort to release and claim memory at the same time has a great negative effect on performance, either.

At which point does your application stop claiming new memory? Close to 1 Gb? 2 Gb? 64 bit applications are able to use larger amounts of memory, but it may not be an option...

like image 127
almulo Avatar answered Nov 15 '22 11:11

almulo