]> source.dussan.org Git - jgit.git/commit
Don't subclass ThreadLocal to avoid memory leak in NLS 43/115043/4
authorMatthias Sohn <matthias.sohn@sap.com>
Mon, 8 Jan 2018 09:40:23 +0000 (10:40 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 14 Feb 2018 20:39:25 +0000 (21:39 +0100)
commit95fc2b210f3df3a1ff5c729dbc0624e3d25d34bd
tree4cc9fcb6b6c216025abaf0443b12591aade389b1
parent95f868f2463ed9de814cff8dbd8f0f90965d4c63
Don't subclass ThreadLocal to avoid memory leak in NLS

These problem usually occur when you subclass ThreadLocal (usually to
implement initialValue). Those classes reference the webapp's
classloader. The ThreadLocal subclass in turn is referenced by each
Thread instance (that's how ThreadLocals are implemented, they have a
"helper-Map" in each Thread instance, so the leak is actually not a tiny
Random instance but the whole webapp's classloader with a bunch of class
definitions and statically referenced parts of the webapp.

Bug: 449321
Change-Id: Ie7a8b0b90e40229e2471202f2a12637b9e0b1d11
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/nls/NLS.java