Permalink
Browse files

Fix for JRUBY-4832: Memory Leak when extending Java class with additi…

…onal Ruby instance variable
  • Loading branch information...
1 parent 9247969 commit 712cd8f8dc48f060d8048f2f6cec1e8cabf7c0ff @headius headius committed Jun 2, 2010
Showing with 11 additions and 9 deletions.
  1. +11 −9 src/org/jruby/java/proxies/ConcreteJavaProxy.java
@@ -159,15 +159,17 @@ public IRubyObject call(ThreadContext context, IRubyObject self, RubyModule claz
return concreteJavaProxy;
}
- @Override
- public Object getVariable(int index) {
- return getRuntime().getJavaSupport().getJavaObjectVariable(this, index);
- }
-
- @Override
- public void setVariable(int index, Object value) {
- getRuntime().getJavaSupport().setJavaObjectVariable(this, index, value);
- }
+ // This alternate ivar logic is disabled because it can cause self-referencing
+ // chains to keep the original object alive. See JRUBY-4832.
+// @Override
+// public Object getVariable(int index) {
+// return getRuntime().getJavaSupport().getJavaObjectVariable(this, index);
+// }
+//
+// @Override
+// public void setVariable(int index, Object value) {
+// getRuntime().getJavaSupport().setJavaObjectVariable(this, index, value);
+// }
/**
* Because we can't physically associate an ID with a Java object, we can

0 comments on commit 712cd8f

Please sign in to comment.