org.apache.cassandra.utils

## Class ObjectSizes

- java.lang.Object
- - org.apache.cassandra.utils.ObjectSizes

-     public class ObjectSizes
      extends java.lang.Object

  A convenience class for wrapping access to MemoryMeter

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectSizes()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static long` | `measure(java.lang.Object pojo)`
    `static long` | `measureDeep(java.lang.Object pojo)`
    `static long` | `sizeOf(java.lang.String str)` Memory a String consumes
    `static long` | `sizeOfArray(byte[] bytes)` Memory a byte array consumes
    `static long` | `sizeOfArray(int[] ints)` Memory an int array consumes
    `static long` | `sizeOfArray(long[] longs)` Memory a long array consumes
    `static long` | `sizeOfArray(java.lang.Object[] objects)` Memory a reference array consumes itself only
    `static long` | `sizeOfReferenceArray(int length)` Memory a reference array consumes
    `static long` | `sizeOnHeapExcludingData(java.nio.ByteBuffer buffer)`
    `static long` | `sizeOnHeapExcludingData(java.nio.ByteBuffer[] array)`
    `static long` | `sizeOnHeapOf(java.nio.ByteBuffer buffer)` Memory a byte buffer consumes
    `static long` | `sizeOnHeapOf(java.nio.ByteBuffer[] array)` Memory a ByteBuffer array consumes.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ObjectSizes

          public ObjectSizes()

  - ### Method Detail

    - #### sizeOfArray

          public static long sizeOfArray(byte[] bytes)

      Memory a byte array consumes
      Parameters:
        `bytes` - byte array to get memory size
      Returns:
        heap-size of the array

    - #### sizeOfArray

          public static long sizeOfArray(long[] longs)

      Memory a long array consumes
      Parameters:
        `longs` - byte array to get memory size
      Returns:
        heap-size of the array

    - #### sizeOfArray

          public static long sizeOfArray(int[] ints)

      Memory an int array consumes
      Parameters:
        `ints` - byte array to get memory size
      Returns:
        heap-size of the array

    - #### sizeOfReferenceArray

          public static long sizeOfReferenceArray(int length)

      Memory a reference array consumes
      Parameters:
        `length` - the length of the reference array
      Returns:
        heap-size of the array

    - #### sizeOfArray

          public static long sizeOfArray(java.lang.Object[] objects)

      Memory a reference array consumes itself only
      Parameters:
        `objects` - the array to size
      Returns:
        heap-size of the array (excluding memory retained by referenced objects)

    - #### sizeOnHeapOf

          public static long sizeOnHeapOf(java.nio.ByteBuffer[] array)

      Memory a ByteBuffer array consumes.

    - #### sizeOnHeapExcludingData

          public static long sizeOnHeapExcludingData(java.nio.ByteBuffer[] array)

    - #### sizeOnHeapOf

          public static long sizeOnHeapOf(java.nio.ByteBuffer buffer)

      Memory a byte buffer consumes
      Parameters:
        `buffer` - ByteBuffer to calculate in memory size
      Returns:
        Total in-memory size of the byte buffer

    - #### sizeOnHeapExcludingData

          public static long sizeOnHeapExcludingData(java.nio.ByteBuffer buffer)

    - #### sizeOf

          public static long sizeOf(java.lang.String str)

      Memory a String consumes
      Parameters:
        `str` - String to calculate memory size of
      Returns:
        Total in-memory size of the String

    - #### measureDeep

          public static long measureDeep(java.lang.Object pojo)

      Parameters:
        `pojo` - the object to measure
      Returns:
        the size on the heap of the instance and all retained heap referenced by it, excluding portions of ByteBuffer that are not directly referenced by it but including any other referenced that may also be retained by other objects.

    - #### measure

          public static long measure(java.lang.Object pojo)

      Parameters:
        `pojo` - the object to measure
      Returns:
        the size on the heap of the instance only, excluding any referenced objects

Copyright © 2018 The Apache Software Foundation