Stack Overflow

  While stacks are generally large, they don't occupy all of memory. It is possible to run out of stack space.

  For example, consider the code we had for factorial.  

   int fact( int n ) {
if ( n == )
return ;
else
return fact( n - ) * n ;
}

  Suppose fact(-1) is called. Then, the base case is never reached (well, it might be reached once we decrement so far that n wraps around to 0 again). This causes one stack frame after another to be pushed.

  Once the stack limit has been reached, we enter into invalid memory addresses, and the operating system takes over and kills your programming, telling you your program has a stack overflow.

  Probably the most common cause of stack overflow is a recursive function that doesn't hit the base case soon enough. For fans of recursion, this can be a problem, so just keep that in mind.

最新文章

  1. Map拷贝 关于对象深拷贝 浅拷贝的问题
  2. webapp之meta
  3. 在Eclipse中生成接口的JUnit测试类
  4. C#函数参数
  5. javascript中的真假值、数据类型判断以及+的特殊用法
  6. 【HDU 5007】Post Robot
  7. @service中构造方法报错
  8. Unity3d之Animation(动画系统)
  9. UCML平台中 如何设置列表单元格中的链接失效
  10. SQL Server 2008数据库创建,备份,还原图解及注意点
  11. 既然函数也是对象,那么为什么this不指向普通函数?
  12. C# FTP下载图片转为Base64
  13. vue路由详解
  14. PDF 补丁丁 0.6.0.3383 版发布(修复书签编辑器坐标定位错误的问题)
  15. ubuntu 安装 eclipse 及其CDT
  16. redis问题与解决思路
  17. Python中DataFrame去重
  18. 全排列问题Ⅱ(Java实现)
  19. PHP 中如何创建和修改数组?
  20. java 测试开发基础知识(类加载,JVM等)

热门文章

  1. 6 DataFrame处理丢失数据--数据清洗
  2. 8.2.3 操作MySQL数据库
  3. 洛谷 1373 dp 小a和uim之大逃离 良心题解
  4. hdu 3572 最大流判断满流
  5. [bzoj3676]回文串[后缀数组+Manacher]
  6. VBox虚拟机与主机(宿主)通讯原理以及socat(套接字猫)简单介绍
  7. 【树状数组】POJ 2155 Matrix
  8. 转:Java阳历转农历
  9. oc49--@class
  10. SuperSocketClientEngine