Java堆空间 [英] java heap space

查看:225
本文介绍了Java堆空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你有什么想法,为什么我能得到一个在线程异常主java.lang.OutOfMemoryError:Java堆空间错误建设我的Andr​​oid应用程序的时候,即使我加入-vmargs -Xmx1024M -Xms512m到Eclipse的论点?
我想知道我可以做什么错误,将在构建时触发这样的错误,因为这在我看来,只有在日食或Maven的错误可能产生在编译的时候这样的错误。
我使用运行作为Maven的安装来构建我的应用程序(使用Maven Android的Eclipse插件)。运行AS->'行家包也产生相同的构建失败,大致1min30等待之后。
我有一台台式电脑的内存3GB,和我的应用程序是几乎没有那么大。

do you have any idea why I could get a 'Exception in thread "main" java.lang.OutOfMemoryError: Java heap space' error when building my android app, even though I added -vmargs -Xmx1024M -Xms512M to the eclipse arguments ? I would like to know what error could I have made that would trigger such an error at build time, as it would appear to me that only a bug in eclipse or maven could produce such an error at build time. I am using run as maven install to build my application (with the maven android eclipse plugin). Run as-> 'maven package' also produces the same build failure, after waiting roughly 1min30. I have a desktop computer with 3GB of memory, and my application isn't nearly that big.

感谢。

推荐答案

添加 -XX:+ HeapDumpOnOutOfMemoryError -XX:HeapDumpPath = /一些/路径来你的JVM ARGS这样当它运行的内存将倾倒在堆出来的。然后,您可以使用 Eclipse的内存分析器或的 与jHat 浏览堆和诊断问题出在哪里也许是。

Add -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/some/path to your jvm args so that when it runs out of memory it will dump out the heap. You can then use Eclipse Memory Analyser or jhat to browse the heap and diagnose where the problem might be.

更新:尝试增加你的Maven Android插件的记忆。在你的的pom.xml ,添加一个JVM参数为 XMX 来插件配置:

Update: Try increasing the memory of your maven android plugin. In your pom.xml, add a JVM argument for Xmx to the plugin configuration:

<plugin>
  <artifactId>maven-android-plugin</artifactId>
  <configuration>
    <jvmArguments>
      <argument>-Xmx1500m</argument>
    </jvmArguments>
  </configuration>
</plugin>

这篇关于Java堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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