On Sat, 9 Apr 2022 06:22:51 GMT, Xue-Lei Andrew Fan <xue...@openjdk.org> wrote:

> Could you have more details? I did not catch the comment about 
> NativeGSSContext.

When `NativeGSSContext(GSSNameElement peer, GSSCredElement myCred, int time, 
GSSLibStub stub)` is called, `pContext` is 0 and you haven't registered the 
cleaner. Later, when `initSecContext()` is called, it calls into 
`cStub.initContext()` and this native method will set `pContext` if a context 
is established. Since you haven't registered the cleaner in the ctor, this 
native context will not be released at the end.

So one solution is to add a `setNativeContext(long pContext)` method and when 
this method is called you register the cleaner. Now, inside the native method, 
instead of setting the `pContext` field directly you can call this setter 
method.

-------------

PR: https://git.openjdk.java.net/jdk/pull/8136

Reply via email to