Package org.nustaq.offheap.bytez.malloc

Examples of org.nustaq.offheap.bytez.malloc.MallocBytezAllocator


    protected void init(int keyLen, long sizeMemBytes, int numberOfElems) {
        numElem = 0;
        bytezOffset = FILE_HEADER_LEN;
        freeList = new FreeList(); // FIXME: missing merge/split of different block sizes
        alloc = new MallocBytezAllocator();
        memory = alloc.alloc(sizeMemBytes);
        customHeader = memory.slice(CORE_HEADER_LEN,CUSTOM_FILEHEADER_LEN);
        tmpValueBytez = new BytezByteSource(memory,0,0);
        this.keyLen = keyLen;
        index = new OffHeapByteTree(keyLen,OffHeapByteTree.estimateMBytesForIndex(keyLen,numberOfElems));
View Full Code Here


                CarBench.Car.class, CarBench.Engine.class, CarBench.Model.class,
                CarBench.Accel.class, CarBench.PerformanceFigures.class,
                CarBench.FueldData.class, CarBench.OptionalExtras.class);
//        OffHeapCoder coder = new OffHeapCoder();

        MallocBytezAllocator alloc = new MallocBytezAllocator();
        MallocBytez bytez = (MallocBytez) alloc.alloc(1000 * 1000);

        ohbench(original, coder, bytez);
        ohbench(original, coder, bytez);
        ohbench(original, coder, bytez);
        ohbench(original, coder, bytez);
        Object deser = ohbench(original, coder, bytez);
        assertTrue(DeepEquals.deepEquals(original, deser));

        System.out.println("-----");
        ohbench(smallClazz, coder, bytez);
        ohbench(smallClazz, coder, bytez);
        ohbench(smallClazz, coder, bytez);
        ohbench(smallClazz, coder, bytez);
        deser = ohbench(smallClazz, coder, bytez);
        assertTrue(DeepEquals.deepEquals(smallClazz, deser));

        boolean lenEx = false;
        try {
            coder.toMemory(original, bytez.getBaseAdress(), 10);
        } catch (Exception e) {
            lenEx = true;
        }

        Assert.assertTrue(lenEx);

        alloc.freeAll();
    }
View Full Code Here

TOP

Related Classes of org.nustaq.offheap.bytez.malloc.MallocBytezAllocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.