Package org.nustaq.offheap.bytez.malloc

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


                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);
View Full Code Here


        this(true);
    }
    public OffHeapCoder(boolean sharedRefs) {
        conf = FSTConfiguration.createFastBinaryConfiguration();
        conf.setShareReferences(sharedRefs);
        writeTarget = new MallocBytez(0l,0);
        readTarget = new MallocBytez(0l,0);
        conf.setStreamCoderFactory(new FSTConfiguration.StreamCoderFactory() {
            @Override
            public FSTEncoder createStreamEncoder() {
                FSTBytezEncoder fstBytezEncoder = new FSTBytezEncoder(conf, writeTarget);
                fstBytezEncoder.setAutoResize(false);
View Full Code Here

        checkIndex(myByteIndex, (int) lenBytes);
        if ( other instanceof HeapBytez) {
            HeapBytez hp = (HeapBytez) other;
            unsafe.copyMemory(base,off+myByteIndex,hp.base,hp.off+otherByteIndex,lenBytes);
        } else if (other instanceof MallocBytez ) {
            MallocBytez mb = (MallocBytez) other;
            unsafe.copyMemory(base,off+myByteIndex,null,otherByteIndex+mb.getBaseAdress(),lenBytes);
        } else {
            for ( long i = 0; i < lenBytes; i++ ) {
                other.put(otherByteIndex+i,get(myByteIndex+i));
            }
        }
View Full Code Here

TOP

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

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.