Add Main.java

This commit is contained in:
William Derr 2025-08-29 14:18:48 +00:00
commit c907a514b0

20
Main.java Normal file
View file

@ -0,0 +1,20 @@
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
public static void main(String[] args) {
List<ByteBuffer> 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();
}
}
}