wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Free memory: Total memory: Max memory: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Free memory: Total memory: Max memory:" Watch "Free memory: Total memory: Max memory:" New topic
Author

Free memory: Total memory: Max memory:

Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
I noticed that (in Tomcat manager) the free memory is around 400 but Total memory is increasing steadily. For example a few hours ago I saw:

Free memory: 392 MB Total memory: 835 MB Max memory: 1186 MB

And now it is:

Free memory: 390 MB Total memory: 959 MB Max memory: 1186 MB

Why is this?


BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Why? - It is just the normal operation of a Java program. Since a server gets an unpredictable sequences of requests, a single moment when multiple request Threads need lots of memory to work will cause the JVM to request more memory, thus causing "total" memory to jump.

Now - if your code does not properly free up objects that are no longer needed you MAY be looking at a "memory leak" but detecting that will take more work.

Bill
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 666
Thanks William (Your book helped me pass exam!).

Now the Tomcat status is:

Free memory: 145.72 MB Total memory: 1186.68 MB Max memory: 1186.68 MB


It has been like this for a few hours but I have not got 'out of memory' error yet. I thought when Total memory reached Max memory I would get this error. Maybe I will get this error when Free memory goes to zero.

Thanks.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Having total memory equal max memory simply means that the last JVM request reached the limit. When trying to meet a new memory request that cant be satisfied with existing memory, the JVM always requests a good sized chunk because requesting memory from the operating system is time consuming.

Glad the book was helpful
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Free memory: Total memory: Max memory:
 
Similar Threads
Help regarding Runtime.java
Tomcat crashes with Out of Memory Error!
Total memory won't reduce after freeing memory allocated for String?
Question on JVM memory in tomcat
Tomcat keeps grows much larger than -Xmx