内存不足错误 [英] OutOfMemoryError

查看:79
本文介绍了内存不足错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主类,其中包含 5 个按钮,每个按钮指向一个程序/包.每个包运行一个 jmf 程序,从网络摄像头捕获图像,它还从文件中加载大约 15 个图像.

I have one main class that contains 5 buttons each link to a program/package. Each package runs a jmf program that capture images from a webcam and it also loads about 15 images from file.

要加载的第一个程序(无论我按下哪个按钮)始终正确运行.但是当我在第一个程序结束后运行一个程序时,发生 java.lang.OutOfMemoryError: java heap space.

The 1st program to load(regardless of which button i press) always runs correctly. But When i run a program after the 1st program ends, java.lang.OutOfMemoryError: java heap space occurs.

我不确定 java 是否无法处理我们所有的图像,或者它是否与 jmf 图像捕获有关.

Im not sure if java can't handle all of our images or if it has something to do with jmf image capture.

推荐答案

也许你应该给你的JVM更多的内存(命令行上的-Xmx512m可能是一个好的开始),

Maybe you should give more memory to your JVM (-Xmx512m on the command line could be a good start),

然后,如果它解决了问题,请调查您的程序为何消耗如此多的内存.

then, if it solves the problem, investigate why your programs consumes so much memory.

sun 诊断工具的使用,例如 jvisualvm 可能会有所帮助.

The use of sun diagnostic tools like jvisualvm could be helpful.

这篇关于内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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