Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Free memory: Total memory: Max memory:

 
Bruce Jin
Ranch Hand
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 672
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic