码迷,mamicode.com
首页 > 数据库 > 详细

voltdb off heap内存的一点代码

时间:2017-08-24 20:08:01      阅读:234      评论:0      收藏:0      [点我收藏+]

标签:res   ret   内存   and   nat   int   creat   ted   address   

ElasticHashinator.java, 


m_tokens = Bits.unsafe.allocateMemory(bytes);
m_cleaner = Cleaner.create(this, new Deallocator(m_tokens, bytes));
private static class Deallocator implements Runnable {
    private long address;
    private int size;
    public Deallocator(long address, int size) {
        this.address = address;
        this.size = size;
    }

    @Override
    public void run() {
        if (address == 0) {
            return;
        }
        Bits.unsafe.freeMemory(address);
        address = 0;
        m_allocatedHashinatorBytes.addAndGet(-size);
    }
}

 


http://www.docjar.com/docs/api/sun/misc/Unsafe.html
http://www.docjar.com/docs/api/sun/misc/Cleaner.html

voltdb off heap内存的一点代码

标签:res   ret   内存   and   nat   int   creat   ted   address   

原文地址:http://www.cnblogs.com/brayden/p/7424245.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!