HAllocator
A Simple C++ Memory Allocator
Loading...
Searching...
No Matches
Classes | Namespaces | Variables
Halloc.hpp File Reference

High-level allocator interface using Red-Black tree for efficient memory management. More...

#include <fstream>
#include <memory>
#include "BlocksContainer.hpp"
Include dependency graph for Halloc.hpp:

Go to the source code of this file.

Classes

class  hh::halloc::Halloc< T, BlockSize, MaxNumBlocks >
 Type-safe allocator using Red-Black tree for best-fit allocation. More...
 
struct  hh::halloc::Halloc< T, BlockSize, MaxNumBlocks >::rebind< U >
 Rebind allocator to allocate different type U. More...
 

Namespaces

namespace  hh
 
namespace  hh::halloc
 

Variables

const int DEFAULT_BLOCK_SIZE = (128 * 1024 * 1024)
 Default block size: 128 MB.
 
const int DEFAULT_MAX_NUM_BLOCKS = 1
 Default max blocks: 1.
 

Detailed Description

High-level allocator interface using Red-Black tree for efficient memory management.

This file defines the main Halloc allocator class, which provides a type-safe, scalable memory allocator built on BlocksContainer. It uses Red-Black trees for O(log n) best-fit allocation and supports automatic block creation.

Default configuration:

Variable Documentation

◆ DEFAULT_BLOCK_SIZE

const int DEFAULT_BLOCK_SIZE = (128 * 1024 * 1024)

Default block size: 128 MB.

◆ DEFAULT_MAX_NUM_BLOCKS

const int DEFAULT_MAX_NUM_BLOCKS = 1

Default max blocks: 1.