Mason Wheeler
Mason Wheeler

Reputation: 84550

Why does having a debugger attached make accelerated video contexts initialize slowly?

I've noticed that when I start up a program that sets up a couple different frames with OpenGL contexts, it will open almost instantly normally, but the context setup seems to take about one second per frame if I run it under a debugger. I see the same effect in both the Delphi debugger and the Visual Studio debugger, so it appears to be a general problem and not specific to one IDE. I've also heard reports of similar slowdowns when the accelerated video system is D3D based, which leads me to think that it's not specific to OpenGL.

Does anyone know why having a debugger attached in general causes accelerated video contexts in general to initialize very slowly?

Upvotes: 0

Views: 147

Answers (3)

Raymond Chen
Raymond Chen

Reputation: 45173

When run under the debugger, a special debug version of the heap is used. That may be what is slowing your program down. More details here, including instructions on how to disable it. http://msdn.microsoft.com/en-us/library/ff538841(v=VS.85).aspx

Upvotes: 1

Paul-Jan
Paul-Jan

Reputation: 17278

I am having a bit of trouble understanding the question, what exactly do you mean by "context setup" when we are talking OpenGL/DirectX? What specific calls in the code seem to be slower when run under a debugger? Could it be that the "context setup" involves the loading of several DLL's, which is monitored and slowed down a lot by using a debugger, especially with the newer Delphi IDE's?

For the record, I don't think I've ever experienced your problem in any of my OpenGL (Delphi 7 and earlier) or Direct3D (Delphi 2009 and above) projects.

Upvotes: 0

Martin Beckett
Martin Beckett

Reputation: 96109

Does it just initialise slowly or also run slowly?

I can image it might both load a debug version of the openGL or DirectX driver with more debug hooks which will take longer.

And it may also run more parts in a software driver rather than hardware - it's tricky for a regular debugger to see whats happening inside a hardware accelerated function built into a graphics chip !

Upvotes: 0

Related Questions