Commit b8547c3c65e1a8c553397be3d8f574c0ce49d144
handle also array in young collections
| |   |
| 296 | 296 | helper.die("vmClass == null in walkObject()"); |
| 297 | 297 | } else if (vmClass.isArray()) { |
| 298 | 298 | if (!vmClass.isPrimitiveArray()) { |
| // checkArrayReferences(object); |
| decrementRefCountForArrayElems(object); |
| 300 | 300 | } |
| 301 | 301 | } else { |
| 302 | 302 | return decrementRefCountForFields(object, (VmNormalClass<?>) vmClass); |
| 303 | 303 | } |
| 304 | 304 | return false; |
| 305 | 305 | } |
|
| |
| private void decrementRefCountForArrayElems(Object object) { |
| try { |
| final Object[] arr = (Object[]) object; |
| final int length = arr.length; |
| for (int i = 0; i < length; i++) { |
| final Object child = arr[i]; |
| if (child != null) { |
| helper.decRef(child); |
| } |
| } |
| } catch (ClassCastException ex) { |
| throw ex; |
| } |
| } |
| |
| 307 | 322 | private final boolean decrementRefCountForFields(Object object, VmNormalClass<?> vmClass) { |
| 308 | 323 | final int[] referenceOffsets = vmClass.getReferenceOffsets(); |
| 309 | 324 | final int cnt = referenceOffsets.length; |