Large Object Heap and String Objects coming from a queue

后端 未结 4 797
终归单人心
终归单人心 2021-02-14 01:06

I have a windows console app that is supposed to run without restarts for days and months. The app retrieves \"work\" from an MSMQ and process it. There are 30 threads that proc

4条回答
  •  执笔经年
    2021-02-14 01:18

    When there is fragmentation on the LOH, it means that there are allocated objects on it. If you can affort the delay, you can once in a while wait till all currently running tasks are finished and call GC.Collect(). When there are no referenced large objects, they will all be collected, effectively removing the fragmentation of the LOH. Of course this only works if (allmost) all large objects are unreferenced.

    Also, moving to a 64 bit OS might also help, since out of memory due to fragmentation is much less likely to be a problem on 64 bits systems, because the virtual space is almost unlimited.

提交回复
热议问题