delphi 内存
Call the function "DoStackOverflow" once from your code and you'll get the EStackOverflow error raised by Delphi with the message "stack overflow".
从您的代码中一次调用函数“ DoStackOverflow”,您将收到Delphi引发的EStackOverflow错误,并显示消息“堆栈溢出”。
function DoStackOverflow : integer;
begin
result := 1 + DoStackOverflow;
end;
What is this "stack" and why there is an overflow there using the code above?
这是什么“堆栈”?为什么使用上面的代码在那里有溢出?
So, the DoStackOverflow function is recursively calling itself -- without an "exit strategy" -- it just keeps on spinning and never exits.
因此,DoStackOverflow函数以递归方式调用自身-没有“退出策略”-它只会不断旋转并且永远不会退出。
A quick fix, you would do, is to clear the obvious bug you have, and ensure the function exists at some point (so your code can continue executing from where you have called the function).
一个快速的解决方法是清除存在的明显错误,并确保该函数在某个时候存在(以便您的代码可以从调用该函数的位置继续执行)。
You move on, and you never look back, not caring about the bug/exception as it is now solved.
您继续前进,您再也不会回头,因为现在已经解决了错误/异常,所以不在乎。
Yet, the question remains: what is this stack and why is there an overflow?
然而,问题仍然存在: 这个堆栈是什么? 为什么会有溢出 ?
Delphi应用程序中的内存 ( Memory in Your Delphi Applications )
When you start programming in Delphi, you might experience bug like the one above, you would solve it and move on. This one is related to memory allocation. Most of the time you would not care about memory allocation as long as you