Skip to content

Instantly share code, notes, and snippets.

@nikoncode
Created December 17, 2018 21:15
Show Gist options
  • Select an option

  • Save nikoncode/f6d8a8e4912126b6b4a8e443bf1aa5f8 to your computer and use it in GitHub Desktop.

Select an option

Save nikoncode/f6d8a8e4912126b6b4a8e443bf1aa5f8 to your computer and use it in GitHub Desktop.
Metaspace OOM
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.List;
public class Class1 {
public static void main(String[] args) throws MalformedURLException, ClassNotFoundException {
final List<Class<?>> classes = new ArrayList<>();
while (true) {
classes.add(new URLClassLoader(
new URL[]{
new URL("http://central.maven.org/maven2/com/google/guava/guava/27.0.1-jre/guava-27.0.1-jre.jar")
}).loadClass("com.google.common.base.Optional"));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment