Add Main.java
This commit is contained in:
commit
c907a514b0
1 changed files with 20 additions and 0 deletions
20
Main.java
Normal file
20
Main.java
Normal 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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue