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 / May 2006

Tip: Looking for answers? Try searching our database.

Exceeding -Xmx memory size

Thread view: 
Chris - 24 May 2006 00:43 GMT
I'm seeing an odd phenomenon on my Linux box. I'm running a Java app that
seems to be consuming more memory than I have given it using the -Xmx
command line switch. The command line says -Xmx256m, but when I run the ps
command to see memory usage (ps -A -F), it says that virtual memory usage is
629mb (VSZ) and physical usage is 434mb (RSS).

How is this possible?

Suse Linux 9.1
Kernel 2.6.5-7.111.19-smp
Sun's JVM version 1.4.2_03
Chris Smith - 24 May 2006 01:17 GMT
> I'm seeing an odd phenomenon on my Linux box. I'm running a Java app that
> seems to be consuming more memory than I have given it using the -Xmx
[quoted text clipped - 3 lines]
>
> How is this possible?

The -Xmx option to the JVM specifies the maximum size of the Java
garbage collected heap.  The size of the process reported by ps will
include that, plus any other memory used by the process.  The following
are examples of things that are not part of the garbage collected heap
and yet are part of the memory required by the process:

  - Code to implement the JVM
  - The C manual heap for data structures implementing the JVM
  - Stacks for all of the threads in the system (app + JVM)
  - Cached Java bytecode (for libraries and the application)
  - JITed machine code (for libraries and the application)
  - Static variables of all loaded classes

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation

Chris - 24 May 2006 02:31 GMT
>> I'm seeing an odd phenomenon on my Linux box. I'm running a Java app that
>> seems to be consuming more memory than I have given it using the -Xmx
[quoted text clipped - 18 lines]
>   - JITed machine code (for libraries and the application)
>   - Static variables of all loaded classes

Is is possible to specify an absolute upper bound on the memory consumed by
the entire process?
Chris Smith - 24 May 2006 02:55 GMT
> Is is possible to specify an absolute upper bound on the memory consumed by
> the entire process?

Well, man ulimit -v, since you seem to be on UNIX.  That would need to
be run within the context of some parent shell whose sole purpose is to
run the application.

This is very posssibly a bad idea, though.  The virtual memory size of a
process hardly matters with the current price levels for disk storage;
and the physical memory size may just mean that you don't have anything
else running that needs memory.  Processes using memory isn't a bad
thing until you need that memory for something else.  Operating systems
do a good job of allocating working sets to processes based on their
actual observed locality at runtime compared to other processes.  Are
you sure you know better than your OS kernel?  You might just be getting
in the way.

Signature

www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



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.