0

Increase the heap size of JVM but doesn't work

For increasing the JVM heap size I set it on 9GB but the result is as the same as 1GB. I need to allocate more memory for project. I tested the result after increasing the JVM heap size for a simple code: int[][] a = new int[32000][32000] int[][] b = new int[32000][32000] The first line is ok but the second line get me heap error. https://www.linkpicture.com/q/IMG_20210602_171503_701.jpg 2(4 × 32000 × 32000) = 2 × 4GB = 8 GB And I set the JVM on 9000MB but still the error! What is the problem, is anyone understand what's the problem? Thanks if you share =)

2nd Jun 2021, 9:13 PM
I U
2 Respuestas
0
How can I know if the machine allow to do this? When I set it and reset the IDE I got no error I have 16GB of RAM so why the program cannot take half of it for itself? Another question, when the JVM is set to 1GB.. this line of code is working ok and I got no error: 2D int array with 32000×32000 size which as I calculate it it must need about 4GB for allocating this arr So how is this working with 1GB heap size for JVM but when I set that to 4GB cannot allocate two of that 2d int array with that size I got confused a lot and no searching helped me for that
2nd Jun 2021, 10:05 PM
I U
0
Thanks! Hmm, Ill see what to do
3rd Jun 2021, 11:02 AM
I U