Hi,
I’m faced OutOfMemoryError from my Java application running on my VEE Port simulator even if I increased the Java Heap size a lot (with core.memory.javaheap.size=30000000
). Here is the Java source code I use:
public static void main(String[] args) {
List<String[]> list = new ArrayList<>();
long freeMemory = -1;
for (int i = 0; i < 1_000; i++) {
freeMemory = Runtime.getRuntime().freeMemory();
String[] newArray;
try {
newArray = new String[5_000];
} catch (OutOfMemoryError oome) {
System.out.println(i);
System.out.println(freeMemory);
break;
}
list.add(newArray);
}
}
Here is the output I get:
=============== [ Initialization Stage ] ===============
=============== [ Converting fonts ] ===============
=============== [ Converting images ] ===============
=============== [ Launching on Simulator ] ===============
203
25934732
=============== [ Completed Successfully ] ===============
SUCCESS
We can see here that OutOfMemoryError occurred even if 25934732 bytes of free memory remains in the Java Heap.
Can you help me please ?
Regards,
Jean