Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

memory not GC'd after hours of sitting idle?

Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a couple of web servers running Tomcat 4.1.27 with j2sdk1.4.2_06, and on a little admin page, we print out the amount of total memory for the JVM and the amount of free memory. At the moment, I have the -Xmx and -Xms flags set to 768m (3/4 of a GB is what I'm going for), so the total is printing out at 799145984 bytes.

I used JMeter to run 200 threads against one of the app servers and it took several minutes to get the free memory down to 100 MB, and then about the same amount of time to push it under 50 MB. After sitting idle for about 6 hours, the sessions have all timed out and the free memory has climbed back up to 389221912 bytes. Why isn't it even higher than this? Most of the big stuff is stored in user sessions, and there aren't many global objects at all. Is the GC just not feeling pressure to do anything?

I didn't do much of anything with the other app server...just logged into a couple of users' sessions, and then parked a web browser on that admin page. Its total memory allocation is also 768 MB, but for some reason it now has only 86183104 bytes free! Another 3 minutes later, and I click refresh on the page and it's down to 77470448...all I or anyone else is doing is refreshing this one fairly simple page! It seems to go down every time I refresh the page. Isn't this bad? What do I check for? A couple of database reads are performed to display info on the page, but the number of open db connections in the pool isn't going up, so I don't think there's a leak there...

Posts: 4313
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm thinking this might be a Tomcat-specific issue?? So I'm going to move it to that forum, hopefully you'll get some good insight there.
Hey! Wanna see my flashlight? It looks like this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic