forked from GitHub/gf-core
the PGF class is now using the new Pool class to manage the life time of the memory allocated in C.
This commit is contained in:
@@ -129,12 +129,6 @@ Java_org_grammaticalframework_pgf_PGF_getStartCat(JNIEnv* env, jobject self)
|
||||
return jname;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_org_grammaticalframework_pgf_PGF_free(JNIEnv* env, jclass cls, jlong pool)
|
||||
{
|
||||
gu_pool_free((GuPool*) pool);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GuMapItor fn;
|
||||
JNIEnv *env;
|
||||
|
||||
@@ -26,24 +26,13 @@ public class PGF {
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// private stuff
|
||||
|
||||
private static native void free(long pool);
|
||||
|
||||
private long pool;
|
||||
private Pool pool;
|
||||
private long ref;
|
||||
|
||||
private PGF(long pool, long ref) {
|
||||
this.pool = pool;
|
||||
this.pool = new Pool(pool);
|
||||
this.ref = ref;
|
||||
}
|
||||
|
||||
protected void finalize () throws Throwable {
|
||||
if (pool != 0) {
|
||||
free(pool);
|
||||
pool = 0;
|
||||
ref = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("jpgf");
|
||||
|
||||
Reference in New Issue
Block a user