Quantcast
Channel: How can I debug OutOfMemoryException without stacktrace? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

How can I debug OutOfMemoryException without stacktrace?

$
0
0

When I run my .NET Core application on linux server I get OutOfMemoryException. I totally don't have any idea how can I debug that because stack trace is not provided. The only output is: "Unhandled Exception: OutOfMemoryException."

At the moment this exception is thrown there is enough space left. 200 GB of RAM is used and 300GB is free so I don't think there should be any problem with memory.

The moment when it happens is that I try to serialize an object into protobuf. The final file should be about 1GB. I have never had this issue before and models serialized pretty well.

I would be very thankful for any insight. I really need to make it work :( I already tried calling this right before serializing because I thought the problem was with fragmentation. After 10 hours of computation I realized it's not the case.

_logger.LogDebug("LOH compaction start");
GCSettings.LargeObjectHeapCompactionMode = 
GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();
_logger.LogDebug("LOH compaction end");

The code I am executing when the exception is thrown is this:

        public static void Serialize<T>(this ProtobufSerializer protobufSerializer, string filePath, T serializationObject)
        {
            using (var fileStream = new FileStream(filePath, FileMode.Create))
            {
                protobufSerializer.Serialize(fileStream, serializationObject);
            }
        }

Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>