Matt Gerrans
Posts: 1153
Nickname: matt
Registered: Feb, 2002
|
|
Re: Garbage Collection in Multithreaded App
|
Posted: Dec 8, 2003 2:23 PM
|
|
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...
|
|