2 Oct 2002 13:43
Memory performance inefficiency caused by Interpreter.DEBUG
I just submitted this to the bug database, but as performance issues had
been raised on the list I thought others might be interested in this
problem and solution.
A number of places in the beanshell code there are lines like:
Interpreter.debug("Trying to load class: "+name);
This doesn't print anything is the default release, but StringBuffer
operations get used and memory gets allocated anyway to construct the
message strings (this doesn't matter so much with constant strings).
This can increase the frequency of garbage collections. There are two
bad offenders in ClassManagerImpl and NameSpace which get called a lot,
according the allocation profiling I've done with JProbe.
These are such an issue that in our local copy of the source I'm
wrapping these two in
if(Interpreter.DEBUG) {
}
statements. This might help some of you if you are having memory use
issues. What the code could really do with is an audit for these. I've
used IDEA to check how often Interpreter.debug() is called and it finds
44 invocations. I can look which of these construct strings with the +
operator, and wrap them in if statements like the above, and submit a
patch if this would be useful Pat.
Nick
(Continue reading)
RSS Feed