I use Java 8 (In Eclipse) when I got this error:
java.lang.OutOfMemoryError: Java heap space
I've tried the -Xmx command but no use even changing the MetaspaceSize doesn't solve it. This problem occurs when I tried to swap elements of list (it size<= 395).
public void permutation(double[] arr, int pos, ArrayList<double[]> list) {
if (arr.length - pos == 1)
list.add(arr.clone());
else
for (int i = pos; i < arr.length; i++) {
swap(arr, pos, i);
permutation(arr, pos + 1, list);
swap(arr, pos, i);
}
}