https://bz.apache.org/bugzilla/show_bug.cgi?id=54537
--- Comment #3 from Rahul Singh <rmadhav...@csc.com> --- Can't we get keep ArrayList as it and instead of removing the object from the list (first line of StatementFinalizer.closeInvoked() method), just get that Statement reference and close that. At the end of loop when all Statements have been closed, we can just call clear() on the list. It will nullify all the references and those will GCed latter. Finding a particular entry in a linked list having millions of objects may also have some cost. With this code method closeInvoked() should look like public void closeInvoked() { for (WeakReference ws : this.statements) { Statement st = (Statement)ws.get(); if (st == null) continue; try { st.close(); } catch (Exception ignore) { if (log.isDebugEnabled()) log.debug("Unable to closed statement upon connection close.", ignore); } } this.statements.clear(); } Hope I am correct!!! -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org