com.amazon.redshift.core.v3

## Class RedshiftMemoryUtils

- java.lang.Object
- - com.amazon.redshift.core.v3.RedshiftMemoryUtils

    public final class RedshiftMemoryUtils
    extends Object

Utility class for memory-related calculations in Redshift JDBC driver. Provides methods to estimate memory usage of result set data structures.

### Method Summary

All Methods Static Methods Concrete Methods
`static int` `calculateNodeSize(Tuple row)` Calculates the estimated memory size in bytes for a tuple node, including JVM overhead.

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

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

### Method Detail

#### calculateNodeSize

    public static int calculateNodeSize(Tuple row)

Calculates the estimated memory size in bytes for a tuple node, including JVM overhead. The calculation includes:

- The actual tuple data size
- JVM object overhead (32 bytes for 64-bit JVM, 16 bytes for 32-bit JVM)
- A scaling factor to account for additional JVM overhead

Note: We don't worry about overflow in this method because: - MEMORY_ESTIMATE_SCALING_FACTOR is 1.2, so even with scaling we're only increasing values by 20% - NODE_OVERHEAD is a modest constant value The main overflow risk comes from accumulating multiple tuples' sizes.

Parameters:
  `row` - The tuple to calculate size for, can be null
Returns:
  Estimated size in bytes, or 0 if the tuple is null