fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. for ( int i = 0; i < 10; i++ ) {
  14. new Thread(new Runnable() {
  15. public void run() {
  16. List<byte[]> byteList = new ArrayList<byte[]>();
  17. while (true) {
  18. byteList.add(new byte[Integer.MAX_VALUE]);
  19. }
  20. }
  21. }).start();
  22. }
  23. }
  24. }
Runtime error #stdin #stdout #stderr 0.08s 382784KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Exception in thread "Thread-0" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at Ideone$1.run(Main.java:18)
	at java.lang.Thread.run(Thread.java:724)
Exception in thread "Thread-1" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at Ideone$1.run(Main.java:18)
	at java.lang.Thread.run(Thread.java:724)
Exception in thread "Thread-2" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at Ideone$1.run(Main.java:18)
	at java.lang.Thread.run(Thread.java:724)
Exception in thread "Thread-3" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
	at Ideone$1.run(Main.java:18)
	at java.lang.Thread.run(Thread.java:724)
Exception in thread "Thread-4" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
Exception in thread "Thread-5" java.lang.OutOfMemoryError: Requested array size exceeds VM limit
Exception in thread "main" java.lang.OutOfMemoryError: unable to create new native thread
	at java.lang.Thread.start0(Native Method)
	at java.lang.Thread.start(Thread.java:693)
	at Ideone.main(Main.java:14)
Exception in thread "Thread-6" java.lang.OutOfMemoryError: Requested array size exceeds VM limit