delphi 内存_了解Delphi中的内存分配

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值