commit c907a514b0e98a405fe3adb3799be5b8d98ee4b1 Author: wderr Date: Fri Aug 29 14:18:48 2025 +0000 Add Main.java diff --git a/Main.java b/Main.java new file mode 100644 index 0000000..310f2fd --- /dev/null +++ b/Main.java @@ -0,0 +1,20 @@ +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; + +//TIP To Run code, press or +// click the icon in the gutter. +public class Main { + public static void main(String[] args) { + List buffers = new ArrayList<>(); + try { + while (true) { + buffers.add(ByteBuffer.allocateDirect(10 * 1024 * 1024)); // 10MB each + } + } catch (OutOfMemoryError e) { + System.err.println("OutOfMemoryError: " + e.getMessage()); + e.printStackTrace(); + } + + } +} \ No newline at end of file