JDK-6338472 : Fonts created with createFont not being freed by GC.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0,6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-10-18
  • Updated: 2010-04-02
  • Resolved: 2005-11-21
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6
5.0u7Fixed 6 b62Fixed
Description
Fonts created with createFont have never been freed until JRE exit although in 1.5
code was added that was supposed to allow this and use the "2D disposer" mechanism
once the font became unreferenced to free the native resources (ie temporary file)
created.

Unfortunately the disposer record keeps a strong reference to the Font (actually
the Font2D) itself due to making the disposer class a non-static nested (inner)
class of the Font2D subclass and so implicitly it has a reference to its enclosing
instance.

Comments
EVALUATION The fix is simply to make those inner classes static.
2005-10-18