Created
June 8, 2010 13:53
-
-
Save griff/430032 to your computer and use it in GitHub Desktop.
A small jruby program that slams the PermGen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BugTest | |
def run | |
puts "Hey" | |
end | |
end | |
# Wait so I can attach VisualVM to inspect | |
puts "Press enter to begin" | |
gets | |
i = 1 | |
while true | |
e = Java::RealData.new | |
# Every instance of BugTest creates a new class in a ClassLoader that doesn't get garbage collected | |
e.setErrors(BugTest.new) | |
# Nice little instance counter for some feedback | |
if (i % 1000) == 0 | |
puts i | |
end | |
i += 1 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RealData | |
{ | |
// Works with any interface | |
private Runnable errors; | |
public void setErrors(Runnable errors) | |
{ | |
this.errors = errors; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment