more changes to avoid dmalloc reporting leaks

This commit is contained in:
Doug MacEachern 2005-11-09 18:22:00 +00:00
parent 0dfdef864c
commit 94d3d82aab
3 changed files with 5 additions and 5 deletions

View File

@ -55,6 +55,7 @@ public abstract class SigarTestCase extends TestCase {
public static void closeSigar() { public static void closeSigar() {
if (sigar != null) { if (sigar != null) {
sigar.close(); sigar.close();
sigar = null;
} }
} }

View File

@ -2,7 +2,6 @@ package net.hyperic.sigar.test;
import net.hyperic.sigar.Sigar; import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
import net.hyperic.sigar.SigarProxy;
import net.hyperic.sigar.Cpu; import net.hyperic.sigar.Cpu;
public class TestCpu extends SigarTestCase { public class TestCpu extends SigarTestCase {
@ -29,8 +28,7 @@ public class TestCpu extends SigarTestCase {
} }
public void testCreate() throws Exception { public void testCreate() throws Exception {
SigarProxy sigar = Sigar.getInstance(); //test reuse Sigar sigar = getSigar();
Cpu cpu = sigar.getCpu(); Cpu cpu = sigar.getCpu();
traceln("getCpu:"); traceln("getCpu:");

View File

@ -2,7 +2,7 @@ package net.hyperic.sigar.test;
import net.hyperic.sigar.SigarException; import net.hyperic.sigar.SigarException;
import net.hyperic.sigar.SigarProxy; import net.hyperic.sigar.SigarProxy;
import net.hyperic.sigar.SynchronizedSigarProxyCache; import net.hyperic.sigar.SigarProxyCache;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
import net.hyperic.sigar.ptql.ProcessQuery; import net.hyperic.sigar.ptql.ProcessQuery;
@ -140,7 +140,8 @@ public class TestPTQL extends SigarTestCase {
} }
public void testCreate() throws Exception { public void testCreate() throws Exception {
SigarProxy proxy = SynchronizedSigarProxyCache.getInstance(); SigarProxy proxy =
SigarProxyCache.newInstance(getSigar());
testOK(proxy); testOK(proxy);
testMalformed(proxy); testMalformed(proxy);