public void testAutoUnloadClassloaders () throws Exception {
		int initialCount = AccessClassLoader.activeAccessClassLoaders();

		ClassLoader testClassLoader1 = new TestClassLoader1();
		Class testClass1 = testClassLoader1.loadClass("com.esotericsoftware.reflectasm.ClassLoaderTest$Test");
		Object testObject1 = testClass1.newInstance();
		FieldAccess access1 = FieldAccess.get(testObject1.getClass());
		access1.set(testObject1, "name", "first");
		assertEquals("first", testObject1.toString());
		assertEquals("first", access1.get(testObject1, "name"));

		ClassLoader testClassLoader2 = new TestClassLoader2();
		Class testClass2 = testClassLoader2.loadClass("com.esotericsoftware.reflectasm.ClassLoaderTest$Test");
		Object testObject2 = testClass2.newInstance();
		FieldAccess access2 = FieldAccess.get(testObject2.getClass());
		access2.set(testObject2, "name", "second");
		assertEquals("second", testObject2.toString());
		assertEquals("second", access2.get(testObject2, "name"));
		
		assertEquals(access1.getClass().toString(), access2.getClass().toString()); // Same class names
		assertFalse(access1.getClass().equals(access2.getClass())); // But different classes
		
		assertEquals(initialCount+2, AccessClassLoader.activeAccessClassLoaders());
		
		testClassLoader1 = null;
		testClass1 = null;
		testObject1 = null;
		access1 = null;
		testClassLoader2 = null;
		testClass2 = null;
		testObject2 = null;
		access2 = null;
		
		// Force GC to reclaim unreachable (or only weak-reachable) objects
		System.gc();
		try {
			Object[] array = new Object[(int) Runtime.getRuntime().maxMemory()];
			System.out.println(array.length);
		} catch (Throwable e) {
			// Ignore OME
		}
		System.gc();
		int times = 0;
		while (AccessClassLoader.activeAccessClassLoaders()>1 && times < 50) { // max 5 seconds, should be instant
			Thread.sleep(100); // test again
			times++;
		}

		// Yeah, both reclaimed!
		assertEquals(Math.min(initialCount, 1), AccessClassLoader.activeAccessClassLoaders());
	}