RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

Peter Levart peter.levart at gmail.com
Thu Jun 21 15:58:43 UTC 2018



On 06/21/2018 05:53 PM, Peter Levart wrote:
> Hi,
>
> On 06/21/2018 09:42 AM, Alan Bateman wrote:
>>
>>
>> On 20/06/2018 15:08, Peter Levart wrote:
>>>
>>> Like the following?
>>>
>>> http://cr.openjdk.java.net/~plevart/jdk-dev/DBBCache_Cleanup/webrev.05/
>> Yes, I think this looks good.
>>
>>>
>>> Do we need a test which proves that cached direct buffers are 
>>> released when thread exits or would a unit test for 
>>> TerminatingThreadLocal be enough? Maybe both?
>> It will be tested by code that uses NIO from threads that exit but I 
>> agree it would be good to add a unit test for this.
>>
>> -Alan
>
> Here's the same patch, with tests added:
>
> http://cr.openjdk.java.net/~plevart/jdk-dev/DBBCache_Cleanup/webrev.06/
>
> Is this good to go? Should I submit the code to testing system first? 
> Please point me to instructions (have not done that yet)...
>
> Regards, Peter
>

It just occurred to me that TempDirectBuffersReclamation test may fail 
if there is concurrent activity in the VM during or even before the test 
(for example if GC/reference processing frees some direct buffers during 
the test as a consequence of activity before the test). How to cope with 
that? Would running the test in separate VM be enough?

Regards, Peter



More information about the core-libs-dev mailing list