summaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.loader/TestLeak.java
blob: 3ef4525959fe537842d615ee79ad28fd1a455e7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.net.*;
import java.lang.reflect.Proxy;

public class TestLeak
{
  static class MyLoader extends URLClassLoader
  {
    public MyLoader (URL urls[])
    {
      super (urls);
    }
  }

  public static void main (String[] args)
  {
    URLClassLoader ucl = 
      (URLClassLoader) ClassLoader.getSystemClassLoader();
    URL urls[] = ucl.getURLs ();
    Class ifaces[] = new Class[1];
    ifaces[0] = java.lang.Comparable.class;

    try {
      for (int i = 0; i < 100; i++)
	{
	  Proxy.getProxyClass (new MyLoader (urls), ifaces);
	} 
    } catch (Exception e) {
      e.printStackTrace ();
    }
  }
}