RFR: 8284490: Remove finalizer method in java.security.jgss [v2]
Valerie Peng
valeriep at openjdk.java.net
Thu Apr 7 17:38:40 UTC 2022
On Thu, 7 Apr 2022 15:48:50 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:
>> 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.
Hmm, the earlier JCE change would also needs to be updated as it calls a cleanup method on the to-be-cleaned object.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8136
More information about the security-dev
mailing list