JDK-6407901 : additional fix for 6255588 - "JDK windows printing implementation leaks GDI objects"
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0u7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-04-03
  • Updated: 2014-02-27
  • Resolved: 2006-05-03
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
5.0u8 b01Fixed
Related Reports
Relates :  
Description
From original CR: 

The JDK's windows printing implementation is leaking GDI objects : 2 per job
seems typical but it's not a "per-job" leak.
Its observable in a process which creates and in some minimal way uses
one or more PrinterJobs as both a growth in native process size (not Java heap)
and in the windows task manager as a leak in GDI Objects (select the column
to view this).

A program as simple as this can demonstrate the problem:

import java.awt.print.*;

public class PT {

    public static void main(String[] args) {
        PrinterJob printerJob = PrinterJob.getPrinterJob();
        for (int i=0;i<10000;i++) {
            printerJob.defaultPage();
        }
    }
}

Comments
EVALUATION this cr enables the complete and proper deletion of (via adding the function 'DeletePrintDC'). The following is an inlined source comment explaining the purpose of 'DeletePrintDC': DeletePrintDC Frees any GDI objects we may have selected into the DC. It is not harmful to call DeleteObject if the retrieved objects happen to be stack objects.
10-04-2006