OutOfMemoryError:GC开销限制超出了android [英] OutOfMemoryError: GC overhead limit exceeded android

查看:151
本文介绍了OutOfMemoryError:GC开销限制超出了android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在android studio 1.5.1中,仅通过将源代码从一个系统移动到另一个系统,即使干净的构建成功了,但是在运行代码时却遇到了此类错误

In android studio 1.5.1 just by moving the source code from one system to another and Even though the clean build is successful but while the code is run I am getting this kind of error

java.lang.OutOfMemoryError:超出了GC开销限制Error:Execution 任务':app:dexDebug'失败. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:处理'命令 '/usr/lib/jvm/java-7-openjdk-amd64/bin/java''完成且非零 退出值3

java.lang.OutOfMemoryError: GC overhead limit exceeded Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 3

我也在app.gradle中添加了以下代码:

I added the below code in app.gradle also:

dexOptions {
        javaMaxHeapSize "4g"
}

推荐答案

GC overhead limit exceeded意味着您的应用占据了所有堆,垃圾回收器无法清理足够的空间来运行程序.

GC overhead limit exceeded means that your app occupied all the heap and garbage collector cannot clean enough space to run the program.

因此,您的应用程序中存在太多必要的数据或内存泄漏(即可以从应用程序根目录访问但不再需要的引用)-只有进一步的应用程序分析才能为您提供更多详细信息

So, there is too much necessary data in memory or memory leak (i.e. references which can be accessed from app root but no longer needed) exists in your application - only further app profiling can give you more details

这篇关于OutOfMemoryError:GC开销限制超出了android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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