aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.4.0/libjava/testsuite/libjava.lang/FileHandleGcTest.java
blob: 8405ead31646c333175a2a6f1766a1f02eaa820b (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
// Make sure that file handles are garbage collected.
import java.io.*;
public class FileHandleGcTest
{
  static void kill () throws FileNotFoundException
  {
    for (int i = 0; i < 65536; i++)
      {
	FileInputStream f = new FileInputStream ("/dev/null");
      }
  }

  public static void
  main (String argv [])
  {
    try
      {
	kill ();
      }
    catch (FileNotFoundException _)
      {
      }
  }
}