Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:自己调用自己为什么会引起 StackOverflowError ! [Re:develop8]
cxp108





发贴: 363
积分: 12
于 2006-06-29 09:00 user profilesend a private message to usersend email to cxp108search all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
楼上2位说的都不是很正确。

这个错误既不是死循环,更不是数组越界。

死循环是程序的大敌,它在大部分时候都不会抛出任何异常,如果有的话也是OutofMemoryError,
OutofMemoryError表示内存耗尽。如果程序运行在Swing GUI上,造成的不利影响会更加严重。
它会使程序陷于“死机”状态,计算机水平较低的用户会认为你的程序造成他系统的死机,因此会抵触
你的程序

StackOverflow指的是堆栈溢出,当程序调用到一个函数时,JVM会在自己的堆栈中加入这个函数的
指令,当这个函数return后,JVM会将这个函数从堆栈中弹出。我们递归调用(也就是函数自己调用自己)
的时候,如果没有一定的return条件,函数的指令会不断的添加到JVM堆栈中,直至超过JVM允许的范围
为止,这时JVM就会抛出StackOverflowError。StackOverflow会导致程序立刻崩溃,但未必会耗尽
内存。因此,相对而言StackOverflow造成的危害要小一些。


cxp108 edited on 2006-07-13 09:32


话题树型展开
人气 标题 作者 字数 发贴时间
6296 自己调用自己为什么会引起 StackOverflowError ! develop8 330 2006-06-23 07:42
4815 Re:自己调用自己为什么会引起 StackOverflowError ! lisliefor 155 2006-06-23 09:32
4818 Re:自己调用自己为什么会引起 StackOverflowError ! zcjl 41 2006-06-23 10:27
4784 Re:自己调用自己为什么会引起 StackOverflowError ! lisliefor 26 2006-06-23 19:14
4784 Re:自己调用自己为什么会引起 StackOverflowError ! zcjl 687 2006-06-23 20:49
5645 Re:自己调用自己为什么会引起 StackOverflowError ! cxp108 458 2006-06-29 09:00
4883 Re:自己调用自己为什么会引起 StackOverflowError ! develop8 25 2006-06-30 08:32
5032 Re:自己调用自己为什么会引起 StackOverflowError ! cxp108 39 2006-07-03 09:04

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923