Companion
Properties
True, iff compressed references (oops) are enabled by this JVM
Approximate memory usage that we assign to a Hashtable / HashMap entry.
Approximate memory usage that we assign to a LinkedHashMap entry.
Number of bytes to represent an array header (no content, but with alignments).
A constant specifying the object alignment boundary inside the JVM. Objects will always take a full multiple of this constant, possibly wasting some space.
Number of bytes to represent an object header (no fields, no alignments).
Number of bytes this JVM uses to represent an object reference.
Sizes of primitive classes.
Approximate memory usage that we assign to all unknown queries - this maps roughly to a BooleanQuery with a couple term clauses.
Approximate memory usage that we assign to all unknown objects - this maps roughly to a few primitive fields and a couple short String-s.
Functions
This method returns the maximum representation size of an object. sizeSoFar is the object's size measured so far. f is the field being probed.
Aligns an object size to be the next multiple of .NUM_BYTES_OBJECT_ALIGNMENT.
Returns bytes in human-readable units (GB, MB, KB or bytes).
Estimates a "shallow" memory usage of the given object. For arrays, this will be the memory taken by array storage (no subreferences will be followed). For objects, this will be the memory taken by the fields.
Returns the shallow size in bytes of the Object[] object.
Returns the size in bytes of the boolean[] object.
Returns the size in bytes of the byte[] object.
Returns the size in bytes of the char[] object.
Returns the size in bytes of the double[] object.
Returns the size in bytes of the float[] object.
Returns the size in bytes of the int[] object.
Returns the size in bytes of the long[] object.
Returns the size in bytes of the short[] object.
Returns the shallow instance size in bytes an instance of the given class would occupy. This works with all conventional classes and primitive types, but not with arrays (the size then depends on the number of elements and varies from object to object).
Returns the size in bytes of the String[] object.
Return the size of the provided array of Accountables by summing up the shallow size of the array and the memory usage reported by each [ ].
Returns the size in bytes of the boolean[] object.
Returns the size in bytes of the byte[] object.
Returns the size in bytes of the char[] object.
Returns the size in bytes of the double[] object.
Returns the size in bytes of the float[] object.
Return the shallow size of the provided Integer object. Ignores the possibility that this object is part of the VM IntegerCache
Returns the size in bytes of the int[] object.
Return the shallow size of the provided Long object. Ignores the possibility that this object is part of the VM LongCache
Returns the size in bytes of the long[] object.
Returns the size in bytes of the short[] object.
Returns the size in bytes of the String object.
Returns the size in bytes of a Query object. Unknown query types will be estimated as .QUERY_DEFAULT_RAM_BYTES_USED.
Returns the size in bytes of the Accountable object, using its method.
Returns the size in bytes of a Query object. Unknown query types will be estimated using .shallowSizeOf, or using the supplied defSize parameter if its value is greater than 0.
Returns the size in bytes of a Collection object, including sizes of its values, supplying .UNKNOWN_DEFAULT_RAM_BYTES_USED when object type is not well known. This method recurses up to .MAX_DEPTH.
Returns the size in bytes of a Collection object, including sizes of its values, supplying default object size when object type is not well known. This method recurses up to .MAX_DEPTH.
Returns the size in bytes of a Map object, including sizes of its keys and values, supplying .UNKNOWN_DEFAULT_RAM_BYTES_USED when object type is not well known. This method recurses up to .MAX_DEPTH.
Returns the size in bytes of a Map object, including sizes of its keys and values, supplying default object size when object type is not well known. This method recurses up to .MAX_DEPTH.
Best effort attempt to estimate the size in bytes of an undetermined object. Known types will be estimated according to their formulas, and all other object sizes will be estimated as .UNKNOWN_DEFAULT_RAM_BYTES_USED.
Best effort attempt to estimate the size in bytes of an undetermined object. Known types will be estimated according to their formulas, and all other object sizes will be estimated using .shallowSizeOf, or using the supplied defSize parameter if its value is greater than 0.