Determine the size of tuple in memory. This is used by data bags to determine their memory size. This need not be exact, but it should be a decent estimation. @return estimated memory size.
()
| 162 | * @return estimated memory size. |
| 163 | */ |
| 164 | @Override |
| 165 | public long getMemorySize() { |
| 166 | Iterator<Object> i = mFields.iterator(); |
| 167 | |
| 168 | // rest of the fixed portion of mfields size is accounted within empty_tuple_size |
| 169 | long mfields_var_size = SizeUtil.roundToEight(4 + 4 * mFields.size()); |
| 170 | // in java hotspot 32bit vm, there seems to be a minimum tuple size of 96 |
| 171 | // which is probably from the minimum size of this array list |
| 172 | mfields_var_size = Math.max(40, mfields_var_size); |
| 173 | |
| 174 | // fixed overhead = 48 bytes |
| 175 | //8 - tuple object header |
| 176 | //8 - mFields reference |
| 177 | //32 - mFields array list fixed size |
| 178 | long sum = 48 + mfields_var_size; |
| 179 | while (i.hasNext()) { |
| 180 | sum += SizeUtil.getPigObjMemSize(i.next()); |
| 181 | } |
| 182 | return sum; |
| 183 | } |
| 184 | |
| 185 | @Override |
| 186 | public int compareTo(Object other) { |
nothing calls this directly
no test coverage detected