I'm using this statement
//some code
int a[][]=new int[5000000][5000000];
//some code
and running it with command
java -mx512m Test
It is giving OutOFMemoryError: Java Heap space indicating the line number of the mentioned statement in the stacktrace
How do i solve this problem
Edit: I'm trying to solve a practice problem on codechef
You may need to consider an approach to your problem which requires less memory.
From Google Calculator (assuming a 64bit integer size):
(5 000 000^2) * 64 bits = 186 264.515 gigabytes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With