20 lines
No EOL
636 B
Java
20 lines
No EOL
636 B
Java
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();
|
|
}
|
|
|
|
}
|
|
} |