Overhead associated with OutputDebugString in release build

后端 未结 8 1865
有刺的猬
有刺的猬 2020-12-15 05:26

Is there a significant overhead associated with calling OutputDebugString in release build?

8条回答
  •  粉色の甜心
    2020-12-15 05:50

    I had read in an article that OutPutDebugString internally does few interesting things:

    1. Creates\Opens mutex and wait infinitely till mutex is acquired.
    2. Passes the data between the application and the debugger is done via a 4kbyte chunk of shared memory, with a Mutex and two Event objects protecting access to it.

    Even if the debugger is not attached ( in release mode) there is significant cost involved in using OutputDebugstring with the usage of various kernel objects.

    Performance hit is very evident if you write a sample code and test.

提交回复
热议问题