Memory leak when calling module_eval with ruby-debug
----------------------------------------------------
Key: JRUBY-5892
URL: https://jira.codehaus.org/browse/JRUBY-5892
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.5.6
Environment: Ubuntu 10.04.2 LTS.
jruby 1.5.6 (ruby 1.8.7 patchlevel 249) (2010-12-03 9cf97c3) (Java HotSpot(TM)
64-Bit Server VM 1.6.0_24) [amd64-java]
Reporter: Jeff Wartes
We moved a JRuby-based service at work from JRuby 1.4 to 1.5.6, and started
encountering a memory leak. We think we've narrowed it down to this repro case:
{noformat}
jwartes1:~$ cat jruby_leak.rb
require 'rubygems'
NUM_ITERATIONS = ARGV[0].to_i
require 'ruby-debug' if ARGV[1] == 'with_debugger'
def overwrite_current_line(s)
print "\x1b[1K\x1b[12D"
print s
STDOUT.flush
end
def iterate(n_count)
puts "Starting..."
(0...n_count).each do |i|
overwrite_current_line( i.to_s ) if i % 1000 == 0
Object.module_eval("Hash")
end
puts
end
iterate(NUM_ITERATIONS)
jwartes1:~$ jruby -J-XX:+HeapDumpOnOutOfMemoryError -J-Xms20M -J-Xmx20M
jruby_leak.rb 1000000
Starting...
999000
jwartes1:~$ jruby -J-XX:+HeapDumpOnOutOfMemoryError -J-Xms20M -J-Xmx20M
jruby_leak.rb 1000000 with_debugger
Starting...
122000java.lang.OutOfMemoryError: GC overhead limit exceeded
Dumping heap to java_pid20897.hprof ...
Heap dump file created [34898233 bytes in 0.583 secs]
Error: Your application used more memory than the safety cap of 20M.
Specify -J-Xmx####m to increase it (#### = cap size in MB).
Specify -w for full OutOfMemoryError stack trace
{noformat}
I'd be happy to provide the heapdump, but I can't get it small enough to attach
to the Jira issue.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email