msvcrt:内存使用量变得疯狂,但在调试器下却没有
我有一个使用 Intel 编译器(32 位)在 MS VC6 模式下编译的 C++ 代码,因此使用 msvcrt.dll 或 msvcrtd.dll。该进程会进行大量内存分配和释放。我使用 WMI 监视内存使用情况并查看 VirtualSize 和workingSetSize。
带调试运行时 (msvcrtd.dll):虚拟常量 1.7GB,工作常量 1.2GB
使用非调试运行时 (msvcrt.dll):虚拟提升 1.7-- 2.1GB,工作提升 1.2-1.4GB
使用非调试运行时但在调试器 (windbg) 下:虚拟常量 1.7GB,工作常量
在 2.1 GB 虚拟时,进程崩溃(如预期)。但是,为什么虚拟使用率仅在(非调试)msvcrt.dll 下且不在调试器下时才会增加? 在所有情况下,编译标志都是相同的,只有运行时库不同。
I have a C++ code compiled with Intel compiler, 32bit, in MS VC6 mode, so using either msvcrt.dll or msvcrtd.dll. The process makes heavy memory allocation and deallocation. I monitor the memory usage with WMI and look at VirtualSize and WorkingSetSize.
with debug runtime (msvcrtd.dll): virtual constant 1.7GB, working constant 1.2GB
with non-debug runtime (msvcrt.dll): virtual raising 1.7-- 2.1GB, working raising 1.2-1.4GB
with non-debug runtime but under debugger (windbg): virtual constant 1.7GB, working constant
At 2.1 GB virtual the process is crashing (as expected). But why would the virtual usage increase only with (non-debug) msvcrt.dll and only if not under debugger?
In all cases compilation flags are identical, only runtime libs are different.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通常,问题是未初始化的局部变量,这些变量被调试 RTL 清空,但在使用发布 RTL 时则不然。查看“生存发行版本”,看看这是否有帮助。
Often the problem is uninitialized local variables which are nulled by the debug RTL, but not when using the release RTL. Have a look at "Surviving the Release Version" and see if this helps.