I have simple program which gives me out of memory issue:
public static void main(String[] args) {
int i[] = new int[457560000];
}
This throws below error :
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
I have tried setting VM arguments in my eclpse like this : -Xms1024M -Xmx2048M, but still getting same error.
I don't need such a big array, but I had an issue with image processing where the image size is very big. While debugging I observed that AWT packages was trying to create this array and failing with memory issues.
How to fix this issue? How much memory I need to set before I run this code?
update:
I also tried with 6GB setting for Xmx under eclipse run configuration VM settings, my machine got hanged for some time but again faced same error.