JDK-8156116 : [macosx] two JNI locals to delete in AWTWindow.m, CGraphicsEnv.m
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u92,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • CPU: generic
  • Submitted: 2016-05-05
  • Updated: 2017-11-29
  • Resolved: 2016-05-20
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 8 JDK 9
8u152Fixed 9 b124Fixed
Description
A JNI local is generally deleted when:

1) the JNI method returns
2) it's wrapped in PushLocalFrame/PopLocalFrame calls
3) DeleteLocalRef is called

The problem is that a JNI local can be created inside an endless message pump (then the 1st point doesn't work), or out of the push/pop block (2nd doesn't work). Then the only way to avoid its leaking is to delete it manually.

(For instance, see JDK-8145984 where missed JNI locals caused memory leaks.)

There're two more JNI locals to delete:

- AWTWindow.m, sendEvent: platformWindow
- CGraphicsEnv.m, displaycb_handle: graphicsEnv