得到错误" java.lang.StackOverflowError:堆栈大小1036KB"和内存不足 [英] getting error "java.lang.StackOverflowError: stack size 1036KB" and OutOfMemory

查看:3812
本文介绍了得到错误" java.lang.StackOverflowError:堆栈大小1036KB"和内存不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我具有完全应用程序中使用的图像和视频工作工作。我存储设备的所有图像和视频到应用程序的数据库,这个任务是在后台服务执行。这个过程与我检查了使用getFacesFromBitmap(mBitmap)的图像检测面。

I am working with an application having totally work with Images and Videos. I am storing all the images and videos of device into database of application and this task is performing in a background service. Between this process I am checking for detecting face in image using getFacesFromBitmap(mBitmap).

问题是,有时我得到的错误。java.lang.StackOverflowError:堆栈大小1036KB,有时我得到OOM错误

The problem is that sometime I am getting error "java.lang.StackOverflowError: stack size 1036KB" and sometimes I am getting OOM error.

那么,有没有解决这个问题的任何最好的方式?

So is there any best way to solve this issue?

推荐答案

的StackOverflowError通常以压倒性的堆栈大小(太多的方法调用对方)引起的。

StackOverflowError is usually caused by an overwhelming stack size (too many methods calling each other)

有时,它是由自称递归(想象永远不断自称的方法!)。方法导致

Sometimes it is caused by methods calling themselves recursively (imagine a method that keeps calling itself forever!).

修复问题取决于它是否是由程序错误,或者您的应用程序只是一个不足的最大堆栈大小的限制引起的。

Fixing the issue depends on whether it is caused by a programmatic mistake, or just an insufficient max-stack-size limitation on your application.

我建议你检查你的code的递归调用,并确保没有方法将保持自称不休。

I recommend that you check your code for recursive calls and make sure no method will keep calling itself endlessly.

另一种选择(你确定有你的code没有问题之后),以增加你的程序,如的堆栈大小:Tomcat的一个名为-Xss参数,可用于调整最大堆栈大小,请检查下面的链接:

The other option (after you make sure there are no problems with your code) is to increase the stack size of your program, e.g.: Tomcat has a parameter named "-Xss" that can be used to tune the maximum stack size, check the link below:

http://www.tomcatexpert.com/blog/2011/11/22/performance-tuning-jvm-running-tomcat

这篇关于得到错误" java.lang.StackOverflowError:堆栈大小1036KB"和内存不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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