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 2007

Tip: Looking for answers? Try searching our database.

Java Memory Question

Thread view: 
threasher - 21 Mar 2007 09:54 GMT
I have a Java application running on Soliaris. When I use the top
command, I can see this:

 PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
29042 ownecx    17  29   10   81M   29M sleep   0:11 14.74% java

The value SIZE is always 81M, and RES is 29M.

When I added -Xmx1K to the application, I thought the application
would throw OutOfMemoryError due to insufficient heap space. But it
didn't, and it still runs fine, and using top command shows that SIZE
is still 81M and RES is still 29M. How can that be? In fact, whatever
value I give for -Xmx does not seem to make any difference at all.

Then I wrote a really simple program with just a couple of lines to
take up some memory. This time, when I play around with -Xmx, it does
throw OutOfMemoryError if the value is too low.

So how come that application is so special? The -Xmx does not make a
difference at all.
Frank Langelage - 21 Mar 2007 20:55 GMT
> I have a Java application running on Soliaris. When I use the top
> command, I can see this:
[quoted text clipped - 16 lines]
> So how come that application is so special? The -Xmx does not make a
> difference at all.

You possible did it the wrong way for the application, it seems to not
come through.
With "jps -v 29042" you get the full command line or use pargs 29042 to
see that this option is not there.
threasher - 22 Mar 2007 03:43 GMT
> > I have a Java application running on Soliaris. When I use the top
> > command, I can see this:
[quoted text clipped - 23 lines]
>
> - Show quoted text -

The application was started like this:

java -Xms4M - Xmx8M com.mycompany.myproject.MyClass

But whichever values I give for -Xms and -Xmx, the top command will
always show that SIZE is around 85M and RES is around 30M.
Lew - 22 Mar 2007 06:07 GMT
> The application was started like this:
>
> java -Xms4M - Xmx8M com.mycompany.myproject.MyClass
>
> But whichever values I give for -Xms and -Xmx, the top command will
> always show that SIZE is around 85M and RES is around 30M.

The -Xms and -Xmx parameters specify Java heap size, not overall 'java'
application size as seen by the OS. Heap is a managed resource within the JVM;
there is still a memory requirement for the JVM itself, for class definitions,
literal constant pools, ...

-- Lew


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.