The Artima Developer Community
Sponsored Link

Java Answers Forum
Garbage Collection in Multithreaded App

1 reply on 1 page. Most recent reply: Dec 8, 2003 2:23 PM by Matt Gerrans

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Greg Tomkins

Posts: 3
Nickname: gregt
Registered: Dec, 2003

Garbage Collection in Multithreaded App Posted: Dec 8, 2003 8:33 AM
Reply to this message Reply
Advertisement
hello,

i am trying to figure out a problem where the Java runtime occassionally spikes up to 100% CPU usage for several minutes. this is a third party app so we dont have source.

to make a long story short i have a theory that garbage collection is running while another thread has something locked, and GC is going out of control until the other lock is released.

i cant find anything on google about how GC responds to this exact scenario. there is some stuff about heap locks but its pretty inconclusive.

any thoughts of whether this is a stupid idea or not? BTW this is HotSpot JVM under HPUX. -mx is 64mb and we have observed that GC alone takes no more than a few seconds, so we dont think GC per se is the problem.

thank you
greg


Matt Gerrans

Posts: 1153
Nickname: matt
Registered: Feb, 2002

Re: Garbage Collection in Multithreaded App Posted: Dec 8, 2003 2:23 PM
Reply to this message Reply
Hmm... Why would the garbage collector be trying to collect anything that was locked? If something it locked, there must be a reference to it, so the garbage collector should have no interest in trying to collect it. Or am I missing something?

Also, such a scenario wouldn't generate high CPU usage, would it? I think that locking itself doesn't (or shouldn't) cause any more or less CPU usage (the waiting thread shouldn't be using any CPU, but the thread it is waiting on may or may not be using a lot of CPU -- it may be slow because of disk access or some other bottleneck). Of course, this probably depends entirely on the JVM implementation, but I doubt that any are so stupidly implemented as to have a "while(1)" type of wait!

I saw some nifty JVM tools that displayed live memory usage and garbage collector activity, but I don't remember which JVM is was. If HotSpot has these tools, that might help you out a lot.

If you can pinpoint the problem to a class file, you might use javap disassemble the code and try to see if that helps...

Flat View: This topic has 1 reply on 1 page
Topic: java class files Previous Topic   Next Topic Topic: JApplet Problem - please help

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use