Skip to content

Instantly share code, notes, and snippets.

@shenie
Last active January 3, 2016 07:39
Show Gist options
  • Save shenie/8431303 to your computer and use it in GitHub Desktop.
Save shenie/8431303 to your computer and use it in GitHub Desktop.
Memory leak in groovy with toString() on instances of mixed in class
class BarMixin {
}
Date.mixin(BarMixin)
100.times {
println "#${it + 1}"
def bar = new Date()
bar.toString()
sleep 100
}
println "check heap and see all those instances of Date even after you forced a GC"
sleep 20000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment