class UseUpMem { public static void main (String[] args) { char[] chunk; int i; final int CHUNKSIZE = 10000; for (i=1; ; ++i) { System.out.println ("Allocating chunk " + i); chunk = new char[CHUNKSIZE]; if (chunk == null) { System.out.println ("Failed to allocate!"); System.exit(1); } } } }