4

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?

2
  • possible duplicate of How is the default java heap size determined? Commented Jan 31, 2012 at 11:00
  • Is the configuration of both Windows and Unix machine same? (Processor, Memory, 32 bit or 64 bit)? Commented Jan 31, 2012 at 11:01

1 Answer 1

5

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.