[笔记]DirectByteBuffer垃圾回收

2023-12-20 19:19:40

参考:https://blog.csdn.net/lom9357bye/article/details/133702169

    public static void main(String[] args) throws Throwable {
        new Thread(() -> {
            ByteBuffer byteBuffer = ByteBuffer.allocateDirect(11);
            byteBuffer.put(0, new byte[]{1,2,3}, 0, 3);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("over");
        }).start();
        Thread.sleep(3000);
        System.gc();
        System.out.println("over1");
    }

在这里插入图片描述

文章来源:https://blog.csdn.net/m1f2c3/article/details/135113486
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。