我如何看到我的delphi应用程序目前使用了多少堆栈空间? [英] how can i see how much of the stack space is currently used in my delphi app?
问题描述
我如何看到目前在我的delphi应用程序中使用了多少堆栈空间?我有一个非常奇怪的错误,听起来像堆栈麻烦。我想将其添加到我的应用程序的日志中,以了解使用/剩余的堆栈空间有多少。使用调试器可能不是很好,因为例程可以被多次调用。
how can i see how much of the stack space is currently used in my delphi app? i had a very strange error that sounds like stack trouble. i'd like to add it to my app's log to get some idea how much stack space is in use/remaining. using the debugger is probably not so great because the routine can be called many times.
谢谢!
推荐答案
这应该给你当前的堆栈使用:
This should give you your current stack usage:
function CurrentStackUsage: DWord;
asm
mov eax, fs:[4]
sub eax, esp
end;
我不记得我的头顶,一个简单的方法来获得最大堆栈大小运行时,但您的链接器选项中具有默认值。
I don't remember off the top of my head a simple way to get the max stack size at run-time, but you have the default value in your linker options.
这篇关于我如何看到我的delphi应用程序目前使用了多少堆栈空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!