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

xerial.larray.buffer.MemoryAllocator Maven / Gradle / Ivy

There is a newer version: 0.4.1
Show newest version
package xerial.larray.buffer;

/**
 * Memory allocator interface
 * @author Taro L. Saito
 */
public interface MemoryAllocator {

    /**
     * Allocate a memory of the specified byte length. The allocated memory must be released via `release`
     * as in malloc() in C/C++.
     * @param size byte length of the memory
     * @return allocated memory information
     */
    Memory allocate(long size);

    /**
     * Get the total amount of allocated memories
     */
    long allocatedSize();

    /**
     * Register a memory
     * @param m
     */
    void register(Memory m);

    /**
     * Release a memory
     */
    void release(Memory m);

    /**
     * Release a memory, referenced by ref
     */
    void release(MemoryReference ref);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy