Hi everybody,
I have a question about a possible memory leak in
ELEvaluator.java. I have noticed when profiling that HashMap entries
(containing Strings, etc.) are kept by the sCachedExpressionStrings
static variable and never removed. Over the course of running an
application for several hours that uses tags that have evaluations in
them, this Map builds up in memory -- in fact I noticed that it was 343k
for just one tag alone after I ran my app for 5 minutes. I have
dynamically constructed expressions, and am concerned that each one is
being cached even if that expression is never used again.
Would it be prudent to use some other kind of Collection to
store these cached expressions (such as one that times out its entries
after a certain amount of time)?
Also, I have toyed with the idea of adding functionality to
permanently disable the cache, but since I do not know the expense of
creating a new ELParser with the String expression, I do not know if
this will cripple my system. I believe I have a normal percentage of
re-used expressions across my tags.
I also find it interesting that there is functionality to bypass
getting values from the cache, but there is not yet a way to disable its
use. Even when bypassing the cache, the cache grows over time.
What do you think about this possible leak?
Sincerely,
Daryl.