RFR: 6543126: Level.known can leak memory
jperkins at redhat.com
Thu Jul 28 20:31:38 UTC 2016
I just happened to take a glance at this and noticed the remove method on
the KnownLevels doesn't quite look right.
Using Optional.of(nameToLevels.get(mirroredLevel.name)).ifPresent((x) ->
x.remove(this)); will produce an NPE if the level is not present. If the
intention is that the levels may not be present in the list the
Optional.ofNullable() should be used.
On Mon, Jul 25, 2016 at 11:10 AM, Daniel Fuchs <daniel.fuchs at oracle.com>
> Please find below a fix for:
> 6543126: Level.known can leak memory
> This is a fix for a long standing issue: Level maintains a list
> of know levels which has strong references to any created levels.
> Because the references are strong references, they prevent the garbage
> collection of levels, level classes, and level class loaders.
> This fix changes the KnownLevel class to extend WeakReference<Level>
> in order to only retain a weak reference to custom level instances.
> best regards,
> -- daniel
James R. Perkins
JBoss by Red Hat
More information about the core-libs-dev