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:
kr.angelov
2013-08-29 05:38:07 +00:00
parent 48b6af710d
commit b37fed3d2d
2 changed files with 2 additions and 19 deletions

View File

@@ -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;

View File

@@ -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");