Module node_pool

Module node_pool 

Source
Expand description

Summary: Object pool for B+ tree nodes. Copyright (c) YOAB. All rights reserved.

This module provides an object pool for B+ tree leaf and branch nodes. Instead of allocating new nodes for every insert and deallocating on every delete, nodes are recycled through the pool.

§Design

  • Maintains separate pools for leaf and branch nodes
  • Released nodes are cleared before being returned to pool
  • Pool has configurable maximum size to bound memory usage
  • Statistics track hit/miss rates for monitoring

§Security

Nodes are cleared when released to prevent data leakage. This ensures that sensitive key/value data from one transaction cannot leak to subsequent transactions through reused nodes.

§Performance

  • Pool hit: O(1) node acquisition
  • Pool miss: O(1) allocation (standard heap allocation)
  • Release: O(n) where n is keys in node (due to clearing)

Structs§

NodePool
Object pool for B+ tree nodes.
PoolStats
Statistics for the node pool.
PooledBranchNode
A branch node for the B+ tree.
PooledLeafNode
A leaf node for the B+ tree.

Constants§

DEFAULT_MAX_POOLED
Default maximum number of nodes to keep in each pool.