OutOfMemoryException when a lot of memory is available

后端 未结 10 1206
悲哀的现实
悲哀的现实 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:21

    GC.Collect() will only free memory where an object is not referenced by anything else.

    A common scenario where a leak can occur is by not disconnecting an event handler from an object before setting it's reference to null.

    As an exercise in avoiding leaks, it's a good idea to implement IDisposable on objects (even tho' it's meant for releasing unmanaged objects), simply from the point of view of ensuring that all handlers are disconnected, collections are cleared correctly and any other object references are set to null.

提交回复
热议问题