从 Visual Studio 启动应用程序时出现页面错误

发布于 2024-11-26 21:46:04 字数 643 浏览 8 评论 0原文

我正在使用 Visual Studio 2010 编写和调试一个小程序。问题是,每当我通过 Visual Studio 2010 启动应用程序时,应用程序的进程都会产生每秒 100000 次的页面错误,这会使程序速度降低 10 倍或更多。当我从文件系统启动生成的可执行文件时,启动完成后不会生成页面错误。这种情况发生在调试和(允许所有优化)发布版本中。没有例外被抛出。

程序本身编译后大小约为 200kib,执行时可保存约 10mib 的数据,并有超过 4gib 的可用内存。只有主线程和日志框架的线程在运行。数据在开始时加载一次,之后仅将结果存储在新分配的内存中并在最后写入日志。

似乎没有很多磁盘活动,Windows 资源监视器指示没有硬故障,而任务管理器显示的数字不断增加。我知道使用 IDE 会带来一些性能损失,但这似乎有点过分了。有什么建议吗?

编辑:

注意:通过减少(取消)分配新内存,我能够将计数减少到大约一半。

Process Explorer 说: Process Explorer

看来调试器有问题。如果我不附加它,它的行为将按预期进行。尽管我仍然想知道为什么它会引起如此大量的页面错误,但它会大大减慢所有构建的速度。

I'm using Visual Studio 2010 to write and debug a small program. The problem is, whenever I start the application through Visual Studio 2010 the process of my application produces page-faults in the range of 100000 per second and that slows down the program by factor 10 or more. When I start the generated executable from the file system no page-faults are generated after the start-up is complete. That happens with the debug and the (all optimizations allowed) release build. No exceptions are getting thrown.

The program itself is compiled around 200kib and when executed holds around 10mib of data with over 4gib of memory available. There are only the main thread and the thread of the logging framework running. The data is loaded once at the start and after that only the results are stored in newly allocated memory and written to the log at the end.

There does not seem to be a lot of disk activity and the Windows Resource Monitor indicates no hard faults, while the Task Manager shows ever increasing numbers. I know that some performance loss is to be expected for using an IDE, but this seems a little bit excessive. Any advice?

Edit:

Note: I was able to get the count down to about half by cutting down on (de-)allocating new memory.

Process Explorer says: Process Explorer

It seems the debugger is at fault. If I do not attach it, it behaves as expected. Although I'm still wondering why it would provoke such a high amount of page faults, that it slows down all builds considerably.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彼岸花ソ最美的依靠 2024-12-03 21:46:04

页面错误是正常的。这是分配内存过程的一部分。这没什么好担心的。

Page faults are normal. It's part of the process of allocating memory. This is nothing to worry about.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文