Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Click 1.4RC2
Description
Attached is the profiler output after 10 000 requests. A number of garbage collections was run so the JVM can reclaim memory. Notice the in the difference column that Context and ClickRequestWrapper increased by 38 instances.
The profiler also indicated that Context is referenced by ThreadLocal variable.
By explicitly nullifying the ThreadLocal Context is bound to removes the leak.
protected void handleRequest(...) {
try
finally
{ ... Context.setThreadLocalContext(null); }}
PS: I vaguely remember handleRequest did nullify the ThreadLocal. If so what was the reason for taking it out? Only reason I can think of is if there are Filters needing access to the Context after handleRequest returned?