Created
February 3, 2020 07:23
-
-
Save zhuyifan2013/88041f771c954ac443595094dbcaf643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
/** | |
* VM options: -Xms2m -Xms2m -XX:+HeapDumpOnOutOfMemoryError | |
*/ | |
public class HeapOOM { | |
static class EObject{ | |
private byte[] myBytes = new byte[200*1024]; | |
} | |
public static void main(String[] args) { | |
List<EObject> list = new ArrayList<>(); | |
while (true) { | |
list.add(new EObject()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment