Inside a complex multithreaded application I am hitting an out-of-memory exceptions maybe once a week. The application is sending/reading massive amounts of data via several sockets, where the read data gets cached to avoid network card buffer overruns.
What is the best strategy to analyse the memory exceptions? During normal run-time, the App is shown with a size of "Total bytes in all Heaps" of up to 1.5 Gigabyte in the Process explorer.
Could it be a strategy to have a thread which is polling either
GC.GetTotalMemory()
or
PrivateMemorySize64()
once a second to know when to start analyzing things? I have not looked into commercial profilers yet and I am a bit concerned of the performance impact of them which could give also wrong results regarding the actual problem analysis.