I'm troubleshooting an application written in .net 4.5 Asp.net + Unity 3.0.1304.1 + Nhibernate 3.3.1.4 that reaches 3 to 5 GB of memory consumption, which is above the expected.
After collecting some Memory Dumps it became clear there was fragmentation on the Large Object Heap.
My first thought was to update the application to .net 4.5.1 and tell GC to compact LOH, but it came to my attention the amount of Pinned Object Arrays, which led to a demo app where was possible to conclude that heap compaction was not helpful on the Pinned Objects scenario and is not even necessary when there is no pinned objects because there is no fragmentation.
So I tried to track this pinned objects and reached this question where it is said that static members are responsible for those pinned objects and that the handles are located on High Frequency Heap.
My questions are:
- How can I proceed to try to solve the fragmentation problem?
- How can I get more info about what is on High Frequency Heap since the commands I know from WinDbg do not work?
Above some prints from windbg: