OutOfMemoryError is raised when runtime.getCurrentContext() and runtime.tearDown() are invoked many times ---------------------------------------------------------------------------------------------------------
Key: JRUBY-4338 URL: http://jira.codehaus.org/browse/JRUBY-4338 Project: JRuby Issue Type: Bug Components: Core Classes/Modules Affects Versions: JRuby 1.5 Reporter: Yoko Harada Attachments: ManyEvals.java, threadservice.patch When runtime.getCurrentContext() and runtime.tearDown() are invoked many times, JRuby raises exception: {noformat} java.lang.OutOfMemoryError: Java heap space at java.util.WeakHashMap.resize(WeakHashMap.java:436) at java.util.WeakHashMap.put(WeakHashMap.java:410) at java.util.Collections$SynchronizedMap.put(Collections.java:1983) at org.jruby.internal.runtime.ThreadService.registerNewThread(ThreadService.java:194) at org.jruby.RubyThread.adoptThread(RubyThread.java:226) at org.jruby.RubyThread.adopt(RubyThread.java:218) at org.jruby.internal.runtime.ThreadService.adoptCurrentThread(ThreadService.java:134) at org.jruby.internal.runtime.ThreadService.getCurrentContext(ThreadService.java:116) at org.jruby.Ruby.getCurrentContext(Ruby.java:2221) at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.getManyVarsDynamicScope(EmbedRubyRuntimeAdapterImpl.java:211) at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.runParser(EmbedRubyRuntimeAdapterImpl.java:170) at org.jruby.embed.internal.EmbedRubyRuntimeAdapterImpl.parse(EmbedRubyRuntimeAdapterImpl.java:91) at org.jruby.embed.ScriptingContainer.parse(ScriptingContainer.java:411) at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:471) at vanilla.ManyEvals.<init>(ManyEvals.java:14) at vanilla.ManyEvals.main(ManyEvals.java:19) {noformat} Since ThreadService#disposeCurrentThread() method doesn't remove any thread from threadContextMap, the map grows larger and larger to cause the exception. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - 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