最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to assign more than 5 GB memory to java in Android Studio? - Stack Overflow

programmeradmin2浏览0评论

My Java app on Mac OS needs to process a file that is 2 gigabytes in size.

I already increased the maximum Heap size of Android Studio to 7000MB, by setting

-Xmx7000m

in the file studio.vmoptions, located in

/Users/[userName]/Library/Application Support/Google/AndroidStudio2024.2

But during the program execution, only 4.2GB are being used by the java process, and

java.lang.OutOfMemoryError: Java heap space

error occurs.

How can this be fixed?

My Java app on Mac OS needs to process a file that is 2 gigabytes in size.

I already increased the maximum Heap size of Android Studio to 7000MB, by setting

-Xmx7000m

in the file studio.vmoptions, located in

/Users/[userName]/Library/Application Support/Google/AndroidStudio2024.2

But during the program execution, only 4.2GB are being used by the java process, and

java.lang.OutOfMemoryError: Java heap space

error occurs.

How can this be fixed?

Share Improve this question asked yesterday A.G.A.G. 2,1195 gold badges31 silver badges40 bronze badges 1
  • 1 Are you sure you need to load the entire file into program memory all at once? What type of file is it? – VGR Commented yesterday
Add a comment  | 

1 Answer 1

Reset to default 0

You can change the app's heap space by changing the launch configuration. You can add in the VM options the -Xmx7000m.

The change you did before in the studio.vmoptions is for the IDE itself.

发布评论

评论列表(0)

  1. 暂无评论