I am running the same java program on a windows and on a linux machine.
on windows i get OutOfMemory if i do not add -Xmx option (set to 512).
while on linux the program runs successfully even without -Xmx option.
My guess is its because windows and linux handles memory differently.
Can anyone explain this behavior?
The default maximum memory is 1/4 up to 1 GB of your main memory on server class machines. e.g. Linux. Windows 32-bit is considered a client class machine and the default maximum is 64 MB.
https://www.oracle.com/technetwork/java/javase/memorymanagement-whitepaper-150215.pdf