Skip to content

Instantly share code, notes, and snippets.

@xolve
Created March 8, 2020 19:01
Show Gist options
  • Save xolve/dd9659dbae8bc3727e802d4b95699967 to your computer and use it in GitHub Desktop.
Save xolve/dd9659dbae8bc3727e802d4b95699967 to your computer and use it in GitHub Desktop.
import java.util.LinkedList;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<byte[]> ls = new LinkedList<>();
try {
while (true) {
byte[] b = new byte[1024 * 1024];
ls.add(b);
}
} catch (Throwable t) {
System.out.println("Caught OOM, clearing.");
ls.clear();
main(args);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment