OutOfMemoryException when a lot of memory is available

后端 未结 10 1212
悲哀的现实
悲哀的现实 2021-02-19 03:38

We have an application that is running on 5 (server) nodes (16 cores, 128 GB Memory each) that loads almost 70 GB data on each machine. This application is distributed and serve

10条回答
  •  抹茶落季
    2021-02-19 04:16

    The GC doesn't take into account the unmanaged heap. If you are creating lots of objects that are merely wrappers in C# to larger unmanaged memory then your memory is being devoured but the GC can't make rational decisions based on this as it only see the managed heap.

    You end up in a situation where the GC collector doesn't think you are short of memory because most of the things on your gen 1 heap are 8 byte references where in actual fact they are like icebergs at sea. Most of the memory is below!

    You can make use of these GC calls:

    System::GC::AddMemoryPressure(sizeOfField);
    System::GC::RemoveMemoryPressure(sizeOfField);
    

    These methods allow the garbage collector to see the unmanaged memory (if you provide it the right figures)

提交回复
热议问题