On Wed, 22 Jul 2026 15:39:30 GMT, Jose Pereda <[email protected]> wrote:
>> This PR creates a native owned copy of the pixel buffer passed to >> GlassPixels::getImage, to let AppKit start, at any later time, the >> rasterization of the images for the system menu bars with a native object >> that outlives the Java buffer. Therefore, if under certain conditions of >> high memory pressure, the latter is reclaimed and collected, the former is >> still available. >> >> A manual test has been included. >> >> Since this is a memory pressure/timing issue, it is not deterministic, and >> depends on several conditions. Therefore, it needs to be run several times >> to spot the issue (before the proposed fix). After the fix, the issue should >> never happen again. >> >> When running it from `tests/manual/systemmenu`, with: >> >> $JAVA_HOME/bin/java @../../../build/run.args >> MacOSSystemMenuImageGraphicTest.java >> >> it might not trigger the crash, but still the icons might be missing or >> garbled most of the runs. >> >> However, with: >> >> >> $JAVA_HOME/bin/javac @../../../build/run.args >> MacOSSystemMenuImageGraphicTest.java // remove --enable-native-access from >> run.args >> $JAVA_HOME/bin/java @../../../build/run.args MacOSSystemMenuImageGraphicTest >> >> the crash is more likely to happen in different runs. >> >> Other options to increase the likelihood of failure is to use a low Xmx, or >> to increase the `COUNTER` value. >> >> --------- >> - [X] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > I've filed https://bugs.openjdk.org/browse/JDK-8388786 for the `NSImage` leak. @jperedadnr Sorry for the delay. This fixes a serious bug, and it would be suitable to consider for jfx27 during RPD2 if you want to make a fix request. ------------- PR Comment: https://git.openjdk.org/jfx/pull/2219#issuecomment-5373486867
