mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8202788: Explicitly reclaim cached thread-local direct buffers at thread exit
Add internal TerminatingThreadLocal and use it to free cached thread-local direct buffers and nio-fs native buffers Reviewed-by: tonyp, alanb
This commit is contained in:
parent
578576f523
commit
6ec2cfcc49
8 changed files with 398 additions and 47 deletions
|
@ -36,6 +36,8 @@ import java.util.HashMap;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
import jdk.internal.misc.TerminatingThreadLocal;
|
||||
import sun.nio.ch.Interruptible;
|
||||
import jdk.internal.reflect.CallerSensitive;
|
||||
import jdk.internal.reflect.Reflection;
|
||||
|
@ -838,6 +840,9 @@ class Thread implements Runnable {
|
|||
* a chance to clean up before it actually exits.
|
||||
*/
|
||||
private void exit() {
|
||||
if (TerminatingThreadLocal.REGISTRY.isPresent()) {
|
||||
TerminatingThreadLocal.threadTerminated();
|
||||
}
|
||||
if (group != null) {
|
||||
group.threadTerminated(this);
|
||||
group = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue