Reputation: 221
the current program I wrote have a very high memory usage like a memory leak. This is observable with help of Nagios. If the memory is very high and the program run very slow I get a memory dump via Windows task manager and analyse it with help of JetBrains dotMemory (External size is ca. 1 GB). Here I see a real usage of ca. 73 MB and a memory usage of generation 2 Heap of 660MB (!), 616 MB are marked as free and 42 MB are in use. The fragmentation is 100%. I know I cannot influence managed memory and the GC should be cleanup the memory automatically. There are any things to consider to solve this problem?
The program is a C# .NET standalone application, build with Visual Studio 2015 and .NET 4.6 in mode "Any CPU". I belive that the .NET framework on the target machine is an other version but how can I get the current installed and used version of .NET runtime?
If you need any other information please ask me for :)
UPDATE
The program is a machine control system that communicate with a SPS via OPC, contains a database access to an Orcale database and a lot of web services for communication with other bordered systems.
UPDATE
Here is the image of memory usage from dotMemory:
Upvotes: 1
Views: 2946
Reputation: 2508
I see a lot of pinned objects (red regions). They are preventing to defragment heaps where they located. Run dotMemory with /internal command line key, there will appear "Pinned objects" link on Heap Fragmentation control, there you can see what objects are pinned.
Upvotes: 3