This question is not about a game and it is specific to Windows, but this seemed like the best place to ask.
We have an app using OpenGL that works fine most of the time. It sometimes fails but it appears this happens only if Windows has been running for at least a few days.
When it happens wglCreateContext() returns zero and GetLastError() returns 6 (invalid handle), or 127 (procedure not found) or sometimes 0 (no error).
Error 6 implies that the HDC is invalid, but there is no evidence of this. Error 127 implies that we are picking up the wrong version of OPENGL32.DLL, but this is not the case. Error 0 implies MS don't have a clue.
When it fails there is plenty of memory available. The only thing I can think is that there is some sort of physical memory or video memory fragmentation.
The system is Windows 2000 with Matrox G450 and 1 Gbyte RAM.