8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 6482247
26 * @summary Test that creating MXBeans does not introduce memory leaks.
27 * @author Eamonn McManus
28 * @modules java.management
29 * @run build LeakTest RandomMXBeanTest MerlinMXBean TigerMXBean
30 * @run main LeakTest
31 */
32
33 /* In this test we create a ClassLoader, then use it to load and run another
34 * jtreg test. When the other test has completed, we wait for the ClassLoader
35 * to be garbage-collected. If it has not been gc'd after a reasonable
36 * amount of time, then something is keeping a reference to the ClassLoader,
37 * which implies a memory leak.
38 *
39 * This test can be applied to any jtreg test, not just the MXBean tests.
40 */
41
42 import java.io.File;
43 import java.lang.ref.Reference;
44 import java.lang.ref.ReferenceQueue;
45 import java.lang.ref.WeakReference;
46 import java.lang.reflect.Method;
47 import java.net.URL;
48 import java.net.URLClassLoader;
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /* @test
25 * @bug 6482247
26 * @summary Test that creating MXBeans does not introduce memory leaks.
27 * @author Eamonn McManus
28 *
29 * @run build LeakTest RandomMXBeanTest MerlinMXBean TigerMXBean
30 * @run main LeakTest
31 */
32
33 /* In this test we create a ClassLoader, then use it to load and run another
34 * jtreg test. When the other test has completed, we wait for the ClassLoader
35 * to be garbage-collected. If it has not been gc'd after a reasonable
36 * amount of time, then something is keeping a reference to the ClassLoader,
37 * which implies a memory leak.
38 *
39 * This test can be applied to any jtreg test, not just the MXBean tests.
40 */
41
42 import java.io.File;
43 import java.lang.ref.Reference;
44 import java.lang.ref.ReferenceQueue;
45 import java.lang.ref.WeakReference;
46 import java.lang.reflect.Method;
47 import java.net.URL;
48 import java.net.URLClassLoader;
|