I have a C# application which occasionally throws an OutOfMemoryException whilst trying to allocate a ByteArray (not huge, normally ~400-500kb).
The communicates with several WCF services, however I'm not sure if this contributes to the issue. We print out memory usage as we go, however there's nothing obviously wrong. The app is resource heavy and its memory usage IS high, but not so high that we get a OOE.
Is there a limit at which the CLR has issues?
Do you know why we could be seeing this exception?
Could it be due to the WCF configuration?(e.g. maxBuffer properties etc.)
2013-02-27 12:01:38,489  INFO - Counters: CPU: 215, Gen0: 6291456, Gen1: 482488, Gen2: 8.201334E+08, LOH: 4.410252E+08, .Net: Private Bytes: 1423708160, Paged: 1424003072,
2013-02-27 12:01:43,504  INFO - Counters: CPU: 291.2773, Gen0: 4194300, Gen1: 1232084, Gen2: 8.494915E+08, LOH: 4.579806E+08, .Net: Private Bytes: 1469743104, Paged: 1470038016,
2013-02-27 12:01:48,520  INFO - Counters: CPU: 285.6698, Gen0: 6291456, Gen1: 662016, Gen2: 8.767135E+08, LOH: 4.999192E+08, .Net: Private Bytes: 1538347008, Paged: 1538641920,
2013-02-27 12:01:53,536  INFO - Counters: CPU: 218.3801, Gen0: 6020000, Gen1: 296772, Gen2: 8.874388E+08, LOH: 5.055583E+08, .Net: Private Bytes: 1556791296, Paged: 1557082112,
System.InsufficientMemoryException: Failed to allocate a managed memory buffer of 459955 bytes. The amount of available memory may be low. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.ServiceModel.Diagnostics.Utility.AllocateByteArray(Int32 size)
--- End of inner exception stack trace ---