How to avoid heap fragmentation?

前端 未结 9 1368
一个人的身影
一个人的身影 2020-12-05 08:14

I\'m currently working on a project for medical image processing, that needs a huge amount of memory. Is there anything I can do to avoid heap fragmentation and to speed up

9条回答
  •  醉梦人生
    2020-12-05 08:49

    If you can isolate exactly those places where you're likely to allocate large blocks, you can (on Windows) directly call VirtualAlloc instead of going through the memory manager. This will avoid fragmentation within the normal memory manager.

    This is an easy solution and it doesn't require you to use a custom memory manager.

提交回复
热议问题