# Estimating Memory Usage

When planning a Curiosity deployment, it is important to estimate the memory (RAM) required to hold the graph structure. Curiosity is designed to be highly memory-efficient, but large graphs still require appropriate resources.

# Base Structures

The core graph elements (Nodes and Edges) are stored efficiently in memory.

# Node Size

A single Node occupies approximately 24 bytes.

  • Note: This does not include the memory for the Edges array itself, which is allocated separately.

# Edge Size

A single Edge occupies 32 bytes.

  • Compression: Curiosity uses bit-packing to compress the timestamp and type IDs into fewer bytes, reducing the footprint from a "naive" 40+ bytes down to 32 bytes.

# UID Sizes

  • UID128: 16 bytes. Used for Nodes.
  • UID64: 8 bytes. Used for Indexes and internal tracking.

# Estimation Formula

To estimate the memory usage for the graph structure alone (excluding content properties like strings, embeddings, etc.), use the following formula:

Memory (Bytes) ≈ (NumNodes × 24) + (NumEdges × 32)

# Vector Index Memory

For embedding indexes (HNSW), memory usage depends on the vector dimension and count:

Vector Memory (Bytes) ≈ NumVectors × Dimensions × 4 (float)

Note: HNSW graphs impose additional overhead for the graph structure connecting the vectors (typically 20-30% extra).

# Example

For a graph with 10 million nodes, 100 million edges, and 1 million vectors (384 dimensions):

  1. Nodes: 10,000,000 × 24 bytes = 240 MB
  2. Edges: 100,000,000 × 32 bytes = 3,200 MB (3.2 GB)
  3. Vectors: 1,000,000 × 384 × 4 bytes = 1,536 MB (1.5 GB)
  4. Total: ~4.94 GB

# Additional Considerations

  • Node Content: The formula above covers only the structure (topology). Actual data properties (Strings, Blobs) are stored separately and loaded on demand or cached. Their memory usage depends heavily on your schema and caching configuration.
  • Overhead: Runtime overhead (object headers, arrays, fragmentation) will add some percentage to the raw estimate. A safe buffer is to add 10-20% to the structural estimate.