voltdb off heap内存的一点代码

Posted brayden

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了voltdb off heap内存的一点代码相关的知识,希望对你有一定的参考价值。

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内存的一点代码的主要内容,如果未能解决你的问题,请参考以下文章