稍后编辑:经过更多调查后,Windows更新和OpenGL DLL变为红鲱鱼。造成这些症状的原因是LoadLibrary()
致电GetLastError() == ERROR_NOT_ENOUGH_MEMORY
失败。请参阅我的答案以了解如何解决此类问题。以下是有历史意义的原始问题。 /编辑LoadLibrary()失败,出现错误8(ERROR_NOT_ENOUGH_MEMORY)
地图查看者我在Python/wxPython中写道:适用于Windows与C++后端突然 停止工作,无需更改任何代码或重新编译,甚至。同样的 可执行文件在数周前一直在工作(相同的Python,相同的DLL,...)。
现在,查询窗口时的像素格式与OpenGL使用(与 ChoosePixelFormat()
),我得到一个消息框说:执行下面的代码片段时,显示
LoadLibrary failed with error 8:
Not enough storage is available to process this command
错误消息:
void DevContext::SetPixelFormat() {
PIXELFORMATDESCRIPTOR pfd;
memset(&pfd, 0, sizeof(pfd));
pfd.nSize = sizeof(pfd);
pfd.nVersion = 1;
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
pfd.iPixelType = PFD_TYPE_RGBA;
pfd.cColorBits = 32;
int pf = ChoosePixelFormat(m_hdc, &pfd); // <-- ERROR OCCURS IN HERE
if (pf == 0) {
throw std::runtime_error("No suitable pixel format.");
}
if (::SetPixelFormat(m_hdc, pf, &pfd) == FALSE) {
throw std::runtime_error("Cannot set pixel format.");
}
}
它实际上是一个显示消息框的ATI GL驱动程序DLL。调用堆栈的相关部分是这样的:
... More MessageBox stuff
0027e860 770cfcf1 USER32!MessageBoxTimeoutA+0x76
0027e880 770cfd36 USER32!MessageBoxExA+0x1b
*** ERROR: Symbol file not found. Defaulted to export symbols for C:\Windows\SysWOW64\atiglpxx.dll -
0027e89c 58471df1 USER32!MessageBoxA+0x18
0027e9d4 58472065 atiglpxx+0x1df1
0027e9dc 57acaf0b atiglpxx!DrvValidateVersion+0x13
0027ea00 57acb0f3 OPENGL32!wglSwapMultipleBuffers+0xc5e
0027edf0 57acb1a9 OPENGL32!wglSwapMultipleBuffers+0xe46
0027edf8 57acc6a4 OPENGL32!wglSwapMultipleBuffers+0xefc
0027ee0c 57ad5658 OPENGL32!wglGetProcAddress+0x45f
0027ee28 57ad5dd4 OPENGL32!wglGetPixelFormat+0x70
0027eec8 57ad6559 OPENGL32!wglDescribePixelFormat+0xa2
0027ef48 751c5ac7 OPENGL32!wglChoosePixelFormat+0x3e
0027ef60 57c78491 GDI32!ChoosePixelFormat+0x28
0027f0b0 57c7867a OutdoorMapper!DevContext::SetPixelFormat+0x71 [winwrap.cpp @ 42]
0027f1a0 57ce3120 OutdoorMapper!OGLContext::OGLContext+0x6a [winwrap.cpp @ 61]
0027f224 1e0acdf2 maplib_sip!func_CreateOGLDisplay+0xc0 [maps.sip @ 96]
0027f240 1e0fac79 python33!PyCFunction_Call+0x52
... More Python stuff
我做了Windows更新两个星期前,发现一些小问题(例如,当 调整窗口大小),但我的程序仍的工作主要是确定。刚刚我重新启动了 ,Windows安装了1个更新,并且我不再通过 ChoosePixelFormat()
了。但是,上次安装的更新是 KB2998527,俄罗斯时区更新?!我已经检查
事情:
- 重新编译并不能使它工作。
- 无法运行其他程序的情况下重新启动并运行不起作用。
- 我的程序内存消耗只有67 MB,我没有内存不足。
- 大量的磁盘空间(〜50 GB)。
HDC m_hdc
从显示面板的HWND
获得,似乎是有效的。- Changing my linker commandline不起作用。
我应该更新我的图形驱动程序还是回滚更新?任何其他想法?
系统数据转储:Windows 7 Ultimate SP1 x64,4GB RAM;惠普EliteBook 8470p; Python 3.3,wxPython 3.0.1.dev76673 msw(phoenix);通过SIP 4.15.4访问C++数据结构;使用Visual Studio 2010 Express编译C++代码,使用/MDd
编译Debug。
使用非常大的图像集时,我建议使用Vips:http://www.vips.ecs.soton.ac.uk/index.php?title=VIPS – datenwolf 2014-09-26 00:12:10