如何保持大量的OutputDebugString()调用在Delphi 6 IDE中降级我的应用程序? [英] How can I keep a large amount of OutputDebugString() calls from degrading my application in the Delphi 6 IDE?

查看:161
本文介绍了如何保持大量的OutputDebugString()调用在Delphi 6 IDE中降级我的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不止一次发生在我身上,导致了许多迷失时光追逐鬼魂。典型的是,当我调试一些非常困难的时序相关代码时,我开始添加了大量的OutputDebugString()调用,所以我可以很好地了解相关操作的顺序。问题是,Delphi 6 IDE似乎只能处理好这么久的情况。我将使用一个具体的例子,我刚刚经历以避免一般性(尽可能的)。

This has happened to me on more than one occasion and has led to many lost hours chasing a ghost. As typical, when I am debugging some really difficult timing-related code I start adding tons of OutputDebugString() calls, so I can get a good picture of the sequence of related operations. The problem is, the Delphi 6 IDE seems to be able to only handle that situation for so long. I'll use a concrete example I just went through to avoid generalities (as much as possible).

我花了几天调试我的线程间信号量锁定代码我的DirectShow时间戳计算码导致一些非常令人沮丧的问题。在消除了我可以想到的每一个错误之后,我仍然有一个问题, Skype ,我的应用程序发送音频。

I spent several days debugging my inter-thread semaphore locking code along with my DirectShow timestamp calculation code that was causing some deeply frustrating problems. After having eliminated every bug I could think of, I still was having a problem with Skype, which my application sends audio to.

大约10秒钟后,我的通话和听到我的声音之间的延迟在Skype上出现在我用于测试的第二台电脑上通话结束,开始增长。大约在20-30秒之间,延迟开始呈指数级增长,此时触发了代码,我检查一下关键部分是否持续时间过长。

After about 10 seconds the delay between my talking and hearing my voice come out of Skype on the second PC that I was using for testing, the far end of the call, started to grow. At around 20 - 30 seconds the delay started to grow exponentially and at that point triggered code I have that checks to see if a critical section was being held too long.

幸运的是晚上不是太晚了,以前一直在通过,我决定停止无情的追踪,并关闭了大部分的OutputDebugString()。幸运的是,我大部分都包装在条件编译器中,所以很容易做到。我做了这个事情,问题消失了,原来我的代码工作正常。

Fortunately it wasn't too late at night and having been through this before, I decided to stop relentlessly tracing and turned off the majority of the OutputDebugString(). Thankfully I had most of them wrapped in a conditional compiler define so it was easy to do. The instant I did this the problems went away, and it turned out my code was working fine.

所以看起来像Delphi 6 IDE开始真的陷入僵局OutputDebugstring()流量高于某个阈值。也许只是将事件日志调试器窗格中添加字符串的任务,该窗格包含所有的OutputDebugString()报告。我不知道,但是当TMemo或类似的控件开始包含太多的字符串时,我的应用程序中也遇到类似的问题。

So it looks like the Delphi 6 IDE starts to really bog down when the amount of OutputDebugstring() traffic is above some threshold. Perhaps it's just the task of adding strings to the Event Log debugger pane, which holds all the OutputDebugString() reports. I don't know, but I have seen similar problems in my applications when a TMemo or similar control starts to contain too many strings.

做了防止这个?有没有办法通过一些方法调用来清除事件日志,或至少限制其大小的方法?此外,您通过条件定义,IDE插件或其他方式使用什么技术来应对这种情况?

What have those of you out there done to prevent this? Is there a way of clearing the Event Log via some method call or at least a way of limiting its size? Also, what techniques do you use via conditional defines, IDE plug-ins, or whatever, to cope with this situation?

推荐答案

在Delphi 2007中发生了类似的问题。在IDE中禁用事件查看,而是使用 DebugView Sysinternals

A similar problem happened to me before with Delphi 2007. Disable event viewing in the IDE and instead use DebugView from Sysinternals.

这篇关于如何保持大量的OutputDebugString()调用在Delphi 6 IDE中降级我的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆