Skip to content

Instantly share code, notes, and snippets.

@sergiolopes
Created August 26, 2011 04:46
Show Gist options
  • Save sergiolopes/1172716 to your computer and use it in GitHub Desktop.
Save sergiolopes/1172716 to your computer and use it in GitHub Desktop.
Como causar um memory leak no Tomcat
// opcao1: ThreadLocal
new ThreadLocal<Object>().set(new Object(){});
// opcao2: Logger
Level customLevel = new Level("Meu Nivel Customizado", 555) {};
Logger.getLogger("teste").log(customLevel, "Log inocente");
// opcao3: Runtime
Runtime.getRuntime().addShutdownHook(new Thread() {});
// opcao4: setProperties
System.setProperties(new Properties(){});
// opcao5: setOut
System.setOut(new PrintStream(System.out){
public void println(String x) {
super.println("MENSAGEM: " + x);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment