com.mindoo.domino.jna.internal.DisposableMemory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of domino-jna Show documentation
Show all versions of domino-jna Show documentation
Java project to access the HCL Domino C API using Java Native Access (JNA)
package com.mindoo.domino.jna.internal;
import com.sun.jna.Memory;
/**
* Subclass of {@link Memory} that can explicitely be disposed to reduce memory usage.
*
* @author Karsten Lehmann
*/
public class DisposableMemory extends Memory {
/**
* Allocate space in the native heap via a call to C's malloc
.
*
* @param size number of bytes of space to allocate
*/
public DisposableMemory(long size) {
super(size);
}
@Override
public synchronized void dispose() {
super.dispose();
}
/**
* Checks if this memory is already disposed
*
* @return true if disposed
*/
public boolean isDisposed() {
return peer == 0;
}
}