Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: JRuby 1.5
-
Fix Version/s: None
-
Component/s: Java Integration
-
Labels:None
-
Number of attachments :
Description
In 1.5, we made a lot of progress toward eliminating the double-wrapping of Java objects present in previous versions. This was accomplished by adding a simple Object reference to JavaProxy and only lazily creating the JavaObject we used with dataWrapStruct.
Unfortunately there's still a lot of cases that use dataGetStruct to get the JavaObject to get the Object, which causes that wrapper to get stood up again. I found a number of cases in JavaProxyMethods, for example, and there may be others around.
In order to really solidify the memory and perf gains from having a simple directly-wrapped Object, we should:
- Fix the cases in JavaProxyMethods
- Add some logging into the lazy code in JavaProxy that shows where it's being called
- Fix those other cases
I've cleaned up a number of cases throughout the codebase by putting a Thread.dumpStack into JavaProxy.dataGetStruct and fixing anything that called it. Those fixes were pushed to master in 7a8e661 and to 1.5 in f81d88f.
A notable number of items were not fixed: specifically, anything in ArrayJavaProxy that calls getJavaArray is still causing a JavaObject (a JavaArray) to be stood up for those operations. This is a larger job to fix than I want to tackle now, since Array logic is still split across Java and Ruby code. I'm marking this bug for 1.6 to address the remainder of the work.