zoukankan      html  css  js  c++  java
  • Summary: Stack Overflow Error

    What is a stack overflow error?

    Parameters and local variables are allocated on the stack (with reference types the object lives on the heap and a variable references that object). The stack typically lives at the upper end of your address space and as it is used up it heads towards the bottom of the address space (i.e. towards zero).
    
    Your process also has a heap, which lives at the bottom end of your process. As you allocate memory this heap can grow towards the upper end of your address space. As you can see, there is the potential for the heap to "collide" with the stack (a bit like tectonic plates!!!).
    
    The common cause for a stack overflow is a bad recursive call. Typically this is caused when your recursive functions doesn't have the correct termination condition, so it ends up calling itself forever. However, with GUI programming it's possible to generate indirect recursion. For example, your app may be handling paint messages and whilst processing them it may call a function that causes the system to send another paint message. Here you've not explicitly called yourself, but the OS/VM has done it for you.
    
    To deal with them you'll need to examine your code. If you've got functions that call themselves then check that you've got a terminating condition. If you have then check than when calling the function you have at least modified one of the arguments, otherwise there'll be no visible change for the recursively called function and the terminating condition is useless.
  • 相关阅读:
    centos7 忘记mysql5.7密码
    阿里云Linux(Centos7)下搭建SVN服务器
    JAVA金额格式字符串转数值
    win10下RabbitMQ的安装和配置
    Oracle update 两表及以上关联更新,出现多值情况,不是一对一更新
    java.lang.OutOfMemoryError: java heap space
    bootstrap.min.css.map
    css 边距等常用设置
    html 标签
    数据库总结
  • 原文地址:https://www.cnblogs.com/EdwardLiu/p/4240605.html
Copyright © 2011-2022 走看看