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

Mario Torre neugens at redhat.com
Mon Jul 22 18:42:19 UTC 2013


On Mon, 2013-07-22 at 16:30 +0400, Andrew Brygin wrote:
> Hello Mario,

Hi Andrew,

Thanks for the reply :)

>  This problem is now tracked  as a bug 8020983:
>  http://bugs.sun.com/view_bug.do?bug_id=8020983
> 
>  This problem can be avoided by an explicit call for reset() or
>  dispose() on an instance of jpeg writer.

Right, but I don't know if this is possible always. It's indeed a valid
workaround if you have some control over the code of course.

I think the original proposed patch is actually a good fix for 6, 7 and
8, because although the Writer is correctly registered to the 2d
disposer, it will never be triggered because of the global strong
reference. It should be safe to use a weak reference here because it's
actually a reference to "this", so it won't be disposed while being
used. Everything else will be cleaned by the Disposer so it should not
matter.

But I'm not a reviewer so I need somebody to approve it first...

Cheers,
Mario





More information about the 2d-dev mailing list