hello-
i have a JVM with the parameters -Xms512m -Xmx1024m. i expected it to
allocate 512m of memory immediately upon startup, but instead it only
allocates ~300m according to the top utility (this is a Linux OS, kernel
2.4.x).
of course, after it runs for a while it will allocate more memory, but why
doesn't it allocate what i have set as a minimum right away?
Steve W. Jackson - 13 Apr 2005 20:59 GMT
> hello-
>
[quoted text clipped - 5 lines]
> of course, after it runs for a while it will allocate more memory, but why
> doesn't it allocate what i have set as a minimum right away?
Those parameters specify the initial and max sizes of the Java heap, not
necessarily of the amount of real memory to be used by the JVM. In most
Unix type systems, it's common for some part of the initial allocation
of memory to be in virtual rather than real memory. In addition, the
breakdown of the Java heap is a rather complex topic, so that the
numbers seen in top may not easily map to something easily measured.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
Michael Amling - 14 Apr 2005 01:00 GMT
> hello-
>
[quoted text clipped - 5 lines]
> of course, after it runs for a while it will allocate more memory, but why
> doesn't it allocate what i have set as a minimum right away?
Which column of top are you looking at? One whose label starts with R
(for Real) or with V (for Virtual)? The virtual memory should be at
least 512m. It won't become real until it's used.
--Mike Amling
gonzo - 14 Apr 2005 14:03 GMT
>> hello-
>>
[quoted text clipped - 11 lines]
>
> --Mike Amling
Here is a sample from top (sorry about the formatting):
Mem: 4627816K av, 3979904K used, 647912K free, 1236K shrd, 1307604K
buff
Swap: 2105184K av, 32200K used, 2072984K free 2326400K
cached
PID USER PRI NI SIZE SWAP RSS SHARE STAT %CPU %MEM TIME COMMAND
17713 ---- 25 0 147M 0 147M 29180 S 0.0
3.2 0:18 java
The JVM seems to be using 147M physical memory and 0 swap. This is
immediately after a restart.
Maybe this is just a problem with top?