特定于系统的错误搜寻?
我最近一直在搞SFML,一个多媒体库。我使用 C#,所以很自然地选择了 .Net 绑定,您可以从最新 2.0 版本的 SVN 获取该绑定。经过一段时间的闲逛后,我注意到我的应用程序有时会在使用 Text 对象(一个用于绘制纹理字体的对象)时挂起。
通过使用分析器和强大的 Windows 任务管理器进行的进一步调查表明,使用 Text 的简单应用程序似乎在某种程度上泄漏了内存。然后我在 SFML 论坛上发布了一个关于它的帖子(该帖子)。然而,SFML 的主要开发人员无法在他的机器上重现该错误。我想我不可能疯了,于是我把它发给了一位朋友,他报告说他确实看到了这件事的发生。
我为 SFML 的开发者 Laurent 做了一个例子,但他仍然无法重现该错误。我认为这可能与操作系统有关,因此我将该文件发送给所有可能的人,并询问他们的操作系统。以下是我的结果:
http://spreadsheets.google.com/ccc?key =0AhcHeJlLGEVUdG1TTi1mTkFxeFlHYVRISXhjbFBDUmc&hl=en
如您所见,Turc 和 K7 都有相同的操作系统,但它不会在 K7 上崩溃(该表不完整,测试候选者尚未重新定位) 。无论如何,这清楚地告诉我这不是操作系统问题。
所以我的实际问题是,除了操作系统或体系结构之外,还有哪些其他因素可以影响此类仅出现在某些系统上的错误?
作为参考,这是我发送给朋友的文件: http://dl.dropbox.com/u/3310651/MemLeak2.rar
以及我所做的分析的屏幕截图: http://dl.dropbox.com/u/3310651/sfml_memleak.png
谢谢!
I have recently been messing around with SFML, a multimedia library. I use C# so naturally I went for the .Net binding, which you can fetch from the SVN in the latest 2.0 version. After a while of messing around I noticed that my application would sometimes hang up when using the Text object, an object used to draw texture fonts.
Further investigation by using profilers and the almighty Windows task manager revealed that a simple application using Text seemed to be somehow leaking memory. I then made a thread on the SFML forums about it (the thread). However, the main dev of SFML was unable to reproduce the bug on his machine. Thinking I couldn't be crazy, I sent it to a friend and he reported that he indeed saw it happening.
I made an example for Laurent, the dev of SFML, but he still couldn't reproduce the bug. Thinking this might be OS related, I sent the file to everyone I could and queried about their OSes. Here are my results:
http://spreadsheets.google.com/ccc?key=0AhcHeJlLGEVUdG1TTi1mTkFxeFlHYVRISXhjbFBDUmc&hl=en
As you can see, Turc and K7 both have the same OS but it doesn't crash on K7's (The table is incomplete where the test candidates didn't haven't repoted in yet). Anyways, this tells me that clearly it isn't an OS issue.
So my actual question is, what other factors but the OS or the architecture can influence bugs like this, that only appear on certain systems?
For reference, here is the file I sent my friends:
http://dl.dropbox.com/u/3310651/MemLeak2.rar
And a screenshot of the profiling I did:
http://dl.dropbox.com/u/3310651/sfml_memleak.png
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定是什么导致了差异,但考虑到您可以在计算机上重现该问题,一种选择是调查为什么所有 Text 对象都在周围。您可以通过使用“sos”调试库并查询以找出 Text 对象的根目录来执行此操作。有关在 Visual Studio 中使用 sos 的详细介绍,请参阅 此处。
如果您只有 Visual Studio Express 版本,则可以使用 WinDbg 调试器中的 sos,该调试器是 Windows 调试工具。可以找到另一个针对将 sos 与 WinDbg 一起使用而定制的很好的概述 在这里。
I'm not sure what could be causing the difference, but given you can reproduce the issue on your machine one option would be to investigate why all the Text objects are hanging around. You can do this by using the "sos" debugging library and querying to find out what is rooting the Text objects. A good introduction to using sos in Visual Studio is available here.
If you only have the Express version of Visual Studio you can use sos from the WinDbg debugger which is part of the Debugging Tools for Windows. Another good overview which is tailored to using sos with WinDbg can be found here.
经过在 IRC 上交谈一段时间以及帮助我的人们后,我找到了答案。本机库不是线程安全的,因此同时分配和取消分配引用的对象会出现问题。
I figured it out after a while of talking on IRC and guys helping me out. The native library wasn't thread safe, so there were issues with allocating and deallocating referred objects at the same time.