MCPcopy Create free account
hub / github.com/apache/pig / getMemorySize

Method getMemorySize

src/org/apache/pig/data/DefaultTuple.java:164–183  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 7

roundToEightMethod · 0.95
getPigObjMemSizeMethod · 0.95
iteratorMethod · 0.65
sizeMethod · 0.65
maxMethod · 0.45
hasNextMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected