Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeepSize

func DeepSize(x interface{}) (bytes int)

    DeepSize estimates the amount of memory used by a Go value. It's intended as a memory usage debugging aid. Argument must be a pointer to a value.

    Not thread safe. Behavior is undefined if any value reachable from the argument is concurrently mutated. In general, do not call this in production.

    Behavior: * Recursively descends into contained values (struct fields, slice elements, etc.), tracking visitation (by memory address) to handle cycles. * Only counts slice length, not unused capacity. * Only counts map key and value size, not map overhead. * Does not count functions or channels.

    The implementation relies on the Go garbage collector being non-compacting (not moving values in memory), due to thread non-safety noted above. This is true as of Go 1.13, but could change in the future.

    Types

    This section is empty.