Search code examples
c#.netout-of-memoryaggregateexception

OutOfMemoryException combined with another exception


I am looking into a memory problem and found this is the log today:

System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Exception of type 'System.OutOfMemoryException' was thrown.Couldn't store <15.02.2017 00:00:00> in period Column. Expected type is String. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

Previous logs have OutOfMemoryException without the inner exception of

Couldn't store <15.02.2017 00:00:00> in period Column. Expected type is String.

Is one leading to the other or is it just random that this exception is thrown at the same time as the OutOfMemoryException? I am not asking how to fix the errors, but why they are seemingly bundled together in this one log statement and not the others. Any explanations/references/ideas?

By the way, this is a .Net Framework application running as a Windows Service on a Windows 2012 Server with 16 GB RAM running a big calculation, so there are plenty of things that can be improved. My task is to improve the code so that is doesn't use so much memory in the first place, and I was hoping to understand the log statement above properly.


Solution

  • I think that during creation of ArgumentException object there was OutOfMemoryException, hence AggregateException