All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vproxy.pni.impl.NoCloseArenaAllocator Maven / Gradle / Ivy

The newest version!
package io.vproxy.pni.impl;

import io.vproxy.pni.Allocator;

import java.lang.foreign.Arena;
import java.lang.foreign.MemorySegment;

public class NoCloseArenaAllocator extends AbstractAllocator implements Allocator {
    private final Arena arena;

    public NoCloseArenaAllocator(Arena arena) {
        this.arena = arena;
    }

    @Override
    public MemorySegment allocate(long size) {
        return arena.allocate(size);
    }

    @Override
    public MemorySegment allocate(long size, int alignment) {
        return arena.allocate(size, alignment);
    }

    public static final NoCloseArenaAllocator GLOBAL = new NoCloseArenaAllocator(Arena.global());
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy