Large Object Heap fragmentation: CLR has any solution to it?

后端 未结 6 825
别那么骄傲
别那么骄傲 2020-12-19 06:15

If you application is such that it has to do lot of allocation/de-allocation of large size objects (>85000 Bytes), its eventually will cause memory fragmentation and you app

6条回答
  •  抹茶落季
    2020-12-19 06:30

    We were precessing images in multiple threads. With images being large enough, this also caused OutOfMemory exceptions due to memory fragmentation. We tried to solve the problem by using unsafe memory and pre-allocating heap for every thread. Unfortunately, this didn't help completely since we relied on several libraries: we were able to solve the problem in our code, but not 3rd party.

    Eventually we replaced threads with processes and let operating system do the hard work. Operating systems have long ago built a solution for memory fragmentation, so it's unwise to ignore it.

提交回复
热议问题