jv m memory

O

Orson

I have question.

I run java program in linux, then I do a ps on process and I see vsize
3.3GB and rssize 1.3GB. Why such big difference? I am trying to know
what is the actual size of jvm in memory at the time. Which one is
right number?

Thank you.
 
N

NeoGeoSNK

I have question.

I run java program in linux, then I do a ps on process and I see vsize
3.3GB and rssize 1.3GB. Why such big difference? I am trying to know
what is the actual size of jvm in memory at the time. Which one is
right number?

Thank you.

You can use the option:
java -Xmx<size> to set maximum Java heap size used.
 
G

GArlington

I have question.

I run java program in linux, then I do a ps on process and I see vsize
3.3GB and rssize 1.3GB. Why such big difference? I am trying to know
what is the actual size of jvm in memory at the time. Which one is
right number?

Thank you.

actualMemoryUsed = java.lang.Runtime.totalMemory() -
java.lang.Runtime.freeMemory()
 
N

Nigel Wade

Orson said:
I have question.

I run java program in linux, then I do a ps on process and I see vsize
3.3GB and rssize 1.3GB. Why such big difference? I am trying to know
what is the actual size of jvm in memory at the time. Which one is
right number?

Thank you.

vsize is the amount of virtual memory the process has requested, the actual
process size may be smaller than this (pages may have been requested but not
yet allocated). rssize is the resident set size, the amount of the process
which is actually resident in physical RAM rather than paged to disk.
 
H

Hugo

I have question.

I run java program in linux, then I do a ps on process and I see vsize
3.3GB and rssize 1.3GB. Why such big difference? I am trying to know
what is the actual size of jvm in memory at the time. Which one is
right number?

Thank you.

The actual size can be obtained via JVM API
 
B

blmblm

It might be useful to read about vsize and rssize in the man page
for "ps" on your system. The one I'm using (Fedora Linux) says
that vsize is

virtual memory size of the process in KiB
(1024-byte units). Device mappings are currently excluded;
this is subject to change.

while rssize is

resident set size, the non-swapped physical memory that a
task has used (in kiloBytes).

It seems entirely plausible to me that a process might be using
much more virtual memory than physical memory -- I mean, if its
address space (virtual memory) contains code or data that's not
being accessed very often, and there's not enough physical memory
to contain the whole address space plus address spaces of other
active processes, well, the operating system should be paging
inactive code/data out to disk.

Disclaimer: I don't claim expertise in operating systems or
memory management, but I've read a couple of undergraduate-level
textbooks.
The actual size can be obtained via JVM API

I started to write "any suggestions about what class? because
surely a Google search for 'JVM' and 'API' isn't going to be
useful" -- but then I tried it, and got this:

http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html

??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top