View Full Version : Random blue screen of death(0x18, POINTER_BY_REFERENCE)

03-24-2016, 06:29 AM
I have been experiencing seemingly random BSOD's after shutting down my own OpenGL application. According to the official description of the error (0x18, POINTER_BY_REFERENCE), it's caused by a driver which incorrectly decrements the reference counter of an object.
Below I've listed some things I have discovered about the problem and methods I have already tried to fix this problem.

The problem is not caused by memory leaking (I checked using CodeXL, no leaks detected)
This (self-coded) program is the only program which causes this type of error, so it is not a driver/hardware problem.
The problem commonly arises when my application is under heavy load (e.g. drawing millions of instances) and when it has been running for a long period of time.
Removing all glDeleteObjects() calls does not solve the problem.
The problem first showed up after adding FBO's to the engine. Back then I solved the problem by fixing some cleanup code. The problem returned after implementing instanced drawing (Mesh::DrawInstanced()), but I don't think this could be the actual cause of the problem since my GL code seems perfectly fine.

So, my request boils down to the following: Could anyone please help me out finding the error causing BSOD's in the source code provided below?

Here's a link to my Visual Studio 2012 project, including a precompiled 800x600 demo. Use at your own risk :P. I hope someone could help me solve this problem since it has been bothering me for a while and I don't want to start all over again.
Any input would be appreciated :)