bitcoin-locked-pool

Crates.iobitcoin-locked-pool
lib.rsbitcoin-locked-pool
version0.1.2
created_at2025-07-09 01:36:17.496527+00
updated_at2025-07-09 08:33:15.913445+00
descriptionA memory pool for locked memory chunks to securely handle sensitive data, preventing it from being swapped to disk.
homepage
repository
max_upload_size
id1743875
size107,877
(klebs6)

documentation

README

bitcoin-locked-pool

Overview

The bitcoin-locked-pool crate provides a memory pool for locked memory chunks, designed to prevent sensitive key data from being swapped to disk. This allows developers to manage memory effectively for cryptographic or sensitive applications where data protection is critical. The pool grows dynamically, managing separate arenas for its administrative tasks, and optimizes locked memory usage, a scarce resource in many operating systems.

Functional Details

  • Locked Memory Pool: Manage and allocate locked memory to prevent data from being paged out.
  • Dynamic Arena Management: Begin with a single arena that scales with demand, allowing for efficient management of resources.
  • Separation of Concerns: Administrative structures are separate from memory management, ensuring only critical data is locked.

Critical Structures

  • LockedPool: Manages memory allocation and deallocation. Ensures arenas are created and tracked effectively.
  • LockedPoolManager: Singleton class that manages a global instance of locked pools, ensuring proper initialization order.
  • LockedPageArena: Represents a single arena of locked pages, handling memory allocation and free operations.
  • LockedPoolStats: Provides statistics on memory usage within the pool, aiding in resource management.

Usage

use bitcoin_locked_pool::{LockedPool, LockedPoolManager};

let pool_manager = LockedPoolManager::instance();
let mut pool = pool_manager.lock();

// Allocate locked memory
let ptr = pool.alloc(1024);

// Free locked memory
pool.free(ptr);

Installation

Add the following to your Cargo.toml:

[dependencies]
bitcoin-locked-pool = "0.1.1"

License

MIT License. See LICENSE file for details.


This README was generated by an AI model and may not be 100% accurate; however, it should be pretty good.

Commit count: 0

cargo fmt