Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

jv m memory

Thread view: 
Orson - 03 Mar 2008 21:34 GMT
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.
NeoGeoSNK - 04 Mar 2008 02:04 GMT
> I have question.
>
[quoted text clipped - 4 lines]
>
> Thank you.

You can use the option:
java -Xmx<size> to set maximum Java heap size used.
GArlington - 04 Mar 2008 10:32 GMT
> I have question.
>
[quoted text clipped - 4 lines]
>
> Thank you.

actualMemoryUsed = java.lang.Runtime.totalMemory() -
java.lang.Runtime.freeMemory()
Nigel Wade - 04 Mar 2008 11:01 GMT
> I have question.
>
[quoted text clipped - 4 lines]
>
> 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.

Signature

Nigel Wade, System Administrator, Space Plasma Physics Group,
           University of Leicester, Leicester, LE1 7RH, UK
E-mail :    nmw@ion.le.ac.uk
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555

Hugo - 06 Mar 2008 06:44 GMT
> I have question.
>
[quoted text clipped - 4 lines]
>
> Thank you.

The actual size can be obtained via JVM API
blmblm@myrealbox.com - 06 Mar 2008 13:49 GMT
> > 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?

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

??

Signature

B. L. Massingill
ObDisclaimer:  I don't speak for my employers; they return the favor.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.