JDK-8235147 : Release HDC from passiveDCList sooner
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7,8,9,10,11,12,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • Submitted: 2019-11-29
  • Updated: 2020-03-10
  • Resolved: 2020-02-25
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.
JDK 15
15 b13Fixed
Related Reports
Relates :  
When a DC becomes unused, it is moved from activeDCList to passiveDCList to be released later. It will stay in the passiveDCList until a new DC is requested for the same window or the window is destroyed.

In a scenario where several windows are created, shown, and then hidden, the stale DCs will be in the passiveDCList for quite a while. These DC will never be used again, they will be released sooner or later.

Thus we can release all DC from passiveDCList when a request for a new DC is received. It will reduce Java usage of GDI resources.
URL: https://hg.openjdk.java.net/jdk/jdk/rev/ea4c6da34c1f User: psadhukhan Date: 2020-03-03 09:13:24 +0000

URL: https://hg.openjdk.java.net/jdk/client/rev/ea4c6da34c1f User: aivanov Date: 2020-02-25 20:01:54 +0000

I attached printHDC.diff along with ManyFramesTest.java as the test case which demonstrate the problem. The log of running the test case is in printHDC.log. When all the frames but one are hidden, passiveDCList contains 9 entries. These entries will not be released until the corresponding window is painted again or destroyed.