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

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

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

import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;

/**
 * Phantom reference to the allocated memory that will be queued to the ReferenceQueue upon GC time
 */
public abstract class MemoryReference extends PhantomReference {
    public final long address;

    /**
     * Create a phantom reference
     * @param m the allocated memory
     * @param queue the reference queue to which GCed reference of the Memory will be put
     */
    public MemoryReference(Memory m, ReferenceQueue queue) {
        super(m, queue);
        this.address = m.headerAddress();
    }

    abstract public Memory toMemory();
    abstract public String name();
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy