[Javabdd-checkins] JavaBDD/net/sf/javabdd BuDDyFactory.java,1.9,1.10
Brought to you by:
joewhaley
From: John W. <joe...@us...> - 2005-05-04 22:23:21
|
Update of /cvsroot/javabdd/JavaBDD/net/sf/javabdd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6129/net/sf/javabdd Modified Files: BuDDyFactory.java Log Message: Don't use finalizer() on bddpairs by default. Index: BuDDyFactory.java =================================================================== RCS file: /cvsroot/javabdd/JavaBDD/net/sf/javabdd/BuDDyFactory.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BuDDyFactory.java 29 Apr 2005 02:25:28 -0000 1.9 --- BuDDyFactory.java 4 May 2005 22:23:12 -0000 1.10 *************** *** 345,349 **** public BDDPairing makePair() { long ptr = makePair0(); ! return new BuDDyBDDPairing(ptr); } private static native long makePair0(); --- 345,353 ---- public BDDPairing makePair() { long ptr = makePair0(); ! if (USE_FINALIZER) { ! return new BuDDyBDDPairingWithFinalizer(ptr); ! } else { ! return new BuDDyBDDPairing(ptr); ! } } private static native long makePair0(); *************** *** 1101,1104 **** --- 1105,1125 ---- private static native void reset0(long ptr); + /** + * Free the memory allocated for this pair. + */ + public void free() { + if (_ptr != 0) free0(_ptr); + _ptr = 0; + } + private static native void free0(long p); + + } + + private static class BuDDyBDDPairingWithFinalizer extends BuDDyBDDPairing { + + private BuDDyBDDPairingWithFinalizer(long ptr) { + super(ptr); + } + /* (non-Javadoc) * @see java.lang.Object#finalize() *************** *** 1106,1118 **** protected void finalize() throws Throwable { super.finalize(); ! if (_ptr != 0) free0(_ptr); ! _ptr = 0; } - /** - * Free the memory allocated for this pair. - */ - private static native void free0(long p); - } --- 1127,1133 ---- protected void finalize() throws Throwable { super.finalize(); ! free(); } } |