重复使用var addIn = Globals.ThisAddIn;堆栈溢出? [英] Does repetitive use of var addIn=Globals.ThisAddIn; causes stack overflow?

查看:89
本文介绍了重复使用var addIn = Globals.ThisAddIn;堆栈溢出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我们无法创建ThisAddIn类的对象,我使用了它的成员

As we can not create object of ThisAddIn class I have used its member by

var addIn=Globals.ThisAddIn;
addIn.membername;



但由于var不能是全局的,我已经在几种方法中使用了它。

现在我得到了 stackoverflow错误

这可能是stackoverflow的原因吗?


but as var could not be global I have used it in several method.
Now I am getting stackoverflow error
Could this be a cause of stackoverflow?

推荐答案

好吧。 ..这可能是堆栈溢出错误的原因,因为 addIn 多次引用本身。



维基百科 [ ^ ]状态:

Well... It might be the reason of stack overflow error, because an addIn refers to "itself" many times.

As Wikipedia[^] states:
引用:

堆栈溢出的最常见原因是过度深度或无限递归,其中函数调用自身的次数太多,以至于存储与每个调用关联的变量和信息所需的空间是不仅可以放在堆栈上

The most common cause of stack overflow is excessively deep or infinite recursion, in which a function calls itself so many times that the space required to store the variables and information associated with each call is more than can fit on the stack





MSDN [ ^ ]说有3个常见原因:



MSDN[^] says that there are 3 common reasons:

Quote:





  • 一个线程使用为它保留的整个堆栈。这通常是由无限递归引起的。
  • 线程无法扩展堆栈,因为页面文件已超出,因此无法提交其他页面来扩展堆栈。
  • A线程无法扩展堆栈,因为系统处于用于扩展页面文件的短暂时间内。




  • 关注用于解决问题的链接。



    Follow the links to resolve the issue.


    这篇关于重复使用var addIn = Globals.ThisAddIn;堆栈溢出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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