Create a memory leak given an interface to conform to

This question already has an answer here:

  • Creating a memory leak with Java 52 answers

  • A simple implementation would have a static list and when doSomething is called, just keep adding the input String to the list. The reason why is because you're storing a strong reference (via the static member) to the strings so the strings cannot be garbage collected.

    链接地址: http://www.djcxy.com/p/19896.html

    上一篇: 你如何使JVM崩溃?

    下一篇: 创建一个内存泄漏给定一个接口符合