What are the negative consequences of turning debug heap off? (_NO_DEBUG_HEAP==1)

后端 未结 1 817
野趣味
野趣味 2021-02-09 04:47

The initial phase of my program loads in significant amounts of data into STL containers. I found that it was taking several minutes before I could reach the real meat of my pro

相关标签:
1条回答
  • 2021-02-09 05:22

    The debug heap impacts performance in two ways:

    First, it adds checks to the heap integrity during heap operations. I haven't found details on these checks, but one assumes that on each allocation or free, it involves verifying the integrity of the data structures used to manage the heap.

    Second, it disables the low-fragmentation heap (LFH) option. In a release build, you get LFH by default. In a debug build, you don't--unless you use the _NO_DEBUG_HEAP. This isn't necessarily a speed penalty, but it might be.

    There are clues in the documentation for HeapSetInformation.

    Note that the C and C++ runtime libraries provide memory management built on top of the system heap APIs, and they also have debug and non-debug modes that can affect performance. There is more detailed documentation about what the debug CRT does. You might check and see if turning off the CRT debugging is enough to get you a significant boost in performance without messing with the debug mode of the process heap.

    0 讨论(0)
提交回复
热议问题