Module memory_pool

Module memory_pool 

Source
Expand description

Advanced-optimized memory pool system for spatial algorithms

This module provides advanced memory management strategies specifically designed for spatial computing algorithms that perform frequent allocations. The system includes object pools, arena allocators, and cache-aware memory layouts to maximize performance.

§Features

  • Object pools: Reusable pools for frequently allocated types
  • Arena allocators: Block-based allocation for temporary objects
  • Cache-aware layouts: Memory alignment for optimal cache performance
  • NUMA-aware allocation: Memory placement for multi-socket systems
  • Zero-copy operations: Minimize data movement and copying

§Examples

use scirs2_spatial::memory_pool::{DistancePool, ClusteringArena};

// Create a distance computation pool
let mut pool = DistancePool::new(1000);

// Get a reusable distance buffer
let buffer = pool.get_distance_buffer(256);

// Use buffer for computations...

// Buffer is automatically returned to pool when dropped (RAII)

Structs§

ArenaStatistics
Arena performance statistics
ArenaVec
RAII wrapper for arena-allocated vectors
ClusteringArena
Arena allocator for temporary objects in clustering algorithms
DistanceBuffer
RAII wrapper for distance buffers with automatic return to pool
DistancePool
Advanced-optimized distance computation memory pool
IndexBuffer
RAII wrapper for index buffers
MatrixBuffer
RAII wrapper for matrix buffers
MemoryPoolConfig
Configuration for memory pool system
NumaCapabilities
NUMA system capabilities
NumaNode
Individual NUMA node information
NumaTopology
NUMA topology information for memory allocation optimization
PoolInfo
Detailed pool information
PoolStatistics
Pool performance statistics

Functions§

create_numa_optimized_pool
Create a NUMA-optimized distance pool for the current thread
get_numa_topology
Get NUMA topology information
global_clustering_arena
Get the global clustering arena instance
global_distance_pool
Get the global distance pool instance
test_numa_capabilities
Test NUMA capabilities and return detailed information