4

Possible Duplicate:
Why does the (Sun) JVM have a fixed upper limit for memory usage (-Xmx)?

JVM should be like any other process and in a normal process, we don't specify max memory available to it and it is limited by say 4GB for 32-bit OS and so on.

Then why in JVM it is not as simple as that and JVM can use that max memory for heap memory as well as native memory, as the need be.

Just a guess, Does it make things somehow more efficient, if JVM knows max heap memory available to it, upfront? and how does it work?

Community
  • 1
  • 1
xyz
  • 8,607
  • 16
  • 66
  • 90

1 Answers1

0

JVM can be used to sandbox a process. Memory needs to be restricted for an effective sandbox (to ensure it doesn't take all the memory - including that required by the OS).

In this way, running Java applications is "safer", in that it is less likely to be able to screw up your computer.

ronalchn
  • 12,225
  • 10
  • 51
  • 61