From c907a514b0e98a405fe3adb3799be5b8d98ee4b1 Mon Sep 17 00:00:00 2001 From: wderr Date: Fri, 29 Aug 2025 14:18:48 +0000 Subject: [PATCH] Add Main.java --- Main.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 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