Your understanding is correct.  But if you set a heap size nearly as big as
your physical memory (or larger) then java may allocate that heap which will
cause swapping.

So swapping is definitely done by the OS, but it is the applications like
Java that can cause the OS to do it.

On Mon, Mar 15, 2010 at 5:05 PM, Lei Zhang <> wrote:

> My understanding is size of heap directly affects how many objects you can
> keep in memory, how soon you get "OutOfMemory" exception. Can somebody
> explain how this affects swapping - which I believe is controlled by OS,
> not
> JVM?

Reply via email to