java.lang.outofmemory异常解析.... [英] java.lang.outofmemory exception resolve ....

查看:271
本文介绍了java.lang.outofmemory异常解析....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何解决java.lang.outofmemory异常?

how to resolve java.lang.outofmemory exception?

推荐答案

您需要提供更多详细信息:
-我们在谈论哪种应用?
-您可以向我们展示一些调试器输出吗?

通常,当内存不足"运行时,代码中会出现非常严重的错误.
在某个地方产生了对象,它们使您的记忆浮起.经常涉及到某些循环,无法正确中断.
You need to provide some more detail:
- what kind of application are we talking about?
- Can you show us some debugger output?

Normally you have a very bad failure in your code when you run "out of memory".
Somewhere are objects produced and they float your memory. Often is some loop involved, which does not break correctly.


该异常是由于JVM无法在堆栈或堆中分配更多的内存而引起的.在大多数情况下,这是由内存泄漏引起的,您正在创建对象引用并且从不销毁它们.

不同的JVM也有不同的限制.如果在J2ME上,则可用内存可能仅为64KB,在服务器上则为64MB.

尝试使用 jhat [
The exception is caused by the JVM not being able to allocate any more memory, either in the stack or on the heap. In most cases this is caused by a memory leak, you are creating object references and never destroying them.

Different JVM''s also have different limits. If this is on a J2ME, then the available memory could be only 64KB, on a server it is as much as 64MB.

Try analysing the heap using jhat[^] to browse the content. You will need to launch the app using the -XX:HeapDumpPath option:
jvm -XX:HeapDumpPath="dumpfile" myapp.jar


您可能正在32位运行时上运行,请尝试使用64位运行时.

在32位中,可用内存限制为大约1.8gb.
You are probably running on the 32bit runtime, try using the 64bit runtime.

In 32bits you are limited to about 1.8gb of usable ram.


这篇关于java.lang.outofmemory异常解析....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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