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

com.mindoo.domino.jna.internal.DisposableMemory Maven / Gradle / Ivy

There is a newer version: 0.9.53
Show newest version
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;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy