[OpenJDK 2D-Dev] JPEGImageWriter memory leak, regression due to fix for 800791

Adam Domurad adomurad at redhat.com
Tue Jul 2 18:30:15 UTC 2013


Hi all, please see the attached Test8007918Regression.java.

There seems to be a regression caused by this patch: 
http://hg.openjdk.java.net/jdk7u/jdk7u-dev/jdk/rev/90c9f1577a0b

As the small testcase demonstrates, creating a JPEGImageWriter and 
calling setOutput causes it to live permanently. This is due to JNI 
global (non-weak) reference in sun/awt/image/jpeg/imageioJPEG.c.

Is it acceptable to simply make this reference weak ? This should bring 
object lifetimes back to how they were before this patch. Attached is a 
patch that, from my tests, fixes the issue.

Thanks & happy hacking,
-Adam
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test8007918Regression.java
Type: text/x-java
Size: 2542 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20130702/2cd68a47/Test8007918Regression.java>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 8000791-regression-fix.patch
Type: text/x-patch
Size: 986 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20130702/2cd68a47/8000791-regression-fix.patch>


More information about the 2d-dev mailing list