Large Arrays, and LOH Fragmentation. What is the accepted convention?

后端 未结 6 1486
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 20:25

I have an other active question HERE regarding some hopeless memory issues that possibly involve LOH Fragmentation among possibly other unknowns.

What my question no

6条回答
  •  臣服心动
    2020-12-05 20:54

    The first thing that comes to mind is to split the array up into smaller ones, so they don't reach the memory needed for the GC to put in it the LOH. You could spit the arrays into smaller ones of say 10,000, and build an object which would know which array to look in based on the indexer you pass.

    Now I haven't seen the code, but I would also question why you need an array that large. I would potentially look at refactoring the code so all of that information doesn't need to be stored in memory at once.

提交回复
热议问题