Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: JRuby 1.1.2
-
Fix Version/s: JRuby 1.1.3
-
Component/s: Core Classes/Modules
-
Labels:None
-
Environment:Mac OS X 10.5.3; J2SE 5.0
-
Testcase included:yes
-
Patch Submitted:Yes
-
Number of attachments :
Description
RubyArrays don't explicitly dereference elements that are removed for Array#clear and leave extra references to other elements in the backing values array as the elements are shifted about in the reject!, delete and delete_at implementations. This causes memory leaks in our application as we rely on Array#clear and Array#delete(_at|_if) to remove references to objects so they may be collected.
Attached is a patch that removes unneeded references to RubyObjects in RubyArray's values array for clear, reject!, delete and delete_at. The patch also includes 4 java unit tests; there is one test for each method which assert invalidated values entries are set to null.