RFR: 8284490: Remove finalizer method in java.security.jgss
Xue-Lei Andrew Fan
xuelei at openjdk.java.net
Thu Apr 7 15:51:43 UTC 2022
On Thu, 7 Apr 2022 10:51:13 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Please review the update to remove finalizer method in the java.security.jgss module. It is one of the efforts to clean up the use of finalizer method in JDK.
>
> src/java.security.jgss/share/classes/sun/security/jgss/wrapper/GSSCredElement.java line 74:
>
>> 72: name = srcName;
>> 73:
>> 74: Cleaner.create().register(this, this::dispose);
>
> This will create a memory leak: `this` will never be garbage collected if it's referenced by the cleaner action.
Yes. I'm working on an update, and more code changes (including immutable objects) may be placed. Thank you @dfuch and @RogerRiggs for the good catch. I totally forgot about the object reference problems while using Cleaner.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8136
More information about the security-dev
mailing list