Android Studio - 如何增加分配的堆大小 [英] Android Studio - How to increase Allocated Heap Size

查看:40
本文介绍了Android Studio - 如何增加分配的堆大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 Android Studio 3 个月了,我开始使用它的应用程序之一已经变得相当大.程序右下角显示的内存使用情况表示我分配的堆最大为 494M.

I've been using Android Studio for 3 months now and one of the apps I started on it has become fairly large. The memory usage indicated at the bottom right of the program says my allocated heap is maxed at 494M.

当我开始更改 XML 文件时,我的内存使用量很快就达到了上限,并且 IDE 会崩溃,并出现类似这样的内存不足错误.

When I start to change the XML files my memory usage quickly reaches that cap and the IDE crashes with an Out Of Memory error like this.

我已尝试使用此方法增加堆大小,但到目前为止没有任何效果.

I've tried to increase the heap size using this but so far there has been no effect.

我查看了数十篇关于如何增加堆大小的文章和其他问题,但他们的答案都没有奏效.无论我对 VMOPTIONS 或 IDE 设置做什么,堆大小都不会增加.我相信我正在为 VMOPTIONS 编辑正确的文件,因为如果我故意给它一个无效的命令,Android Studio 会抱怨它并且不会启动.

I've looked at dozens of articles and other questions on how to increase the heap size but none of their answers are working. No matter what I do to the VMOPTIONS or the IDE settings the heap size never increases. I believe I am editting the correct file for the VMOPTIONS because if I purposely give it an invalid command Android Studio complains about it and doesn't start.

我使用的是 Windows 7 - 64 位,并有 16GB 内存.有没有其他人在 Android Studio 上遇到过这个问题?你能修好它吗?

I'm using windows 7 - 64 bit and have 16GB RAM. Has anyone else had this problem with Android Studio? And were you able to fix it?

推荐答案

我查看了我的环境变量并有一个名为 _JAVA_OPTIONS 的系统变量,其值为 -Xms256m -Xmx512m,将其更改为 -Xms256m -Xmx1024m 后,最大堆大小相应增加.

I looked at my Environment Variables and had a System Variable called _JAVA_OPTIONS with the value -Xms256m -Xmx512m, after changing this to -Xms256m -Xmx1024m the max heap size increased accordingly.

这篇关于Android Studio - 如何增加分配的堆大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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