HAllocator
A Simple C++ Memory Allocator
Loading...
Searching...
No Matches
Public Attributes | List of all members
hh::halloc::MemoryNode Struct Reference

Node structure for both Red-Black tree and doubly-linked list. More...

#include <Block.hpp>

Collaboration diagram for hh::halloc::MemoryNode:
Collaboration graph
[legend]

Public Attributes

MemoryNodeleft
 Left child in Red-Black tree.
 
MemoryNoderight
 Right child in Red-Black tree.
 
MemoryNodeparent
 Parent node in Red-Black tree.
 
std::size_t value
 Encoded value containing size, status, and color.
 
MemoryNodenext
 Next node in memory sequence (doubly-linked list)
 
MemoryNodeprev
 Previous node in memory sequence (doubly-linked list)
 

Detailed Description

Node structure for both Red-Black tree and doubly-linked list.

Each node represents a memory region (either free or allocated). The node serves dual purposes:

Note
Bit 63 of value: Red-Black tree color (1=Red, 0=Black)
Bit 62 of value: Allocation status (1=Used, 0=Free)
Bits 0-61 of value: Size of the memory region in bytes

Member Data Documentation

◆ left

MemoryNode* hh::halloc::MemoryNode::left

Left child in Red-Black tree.

◆ next

MemoryNode* hh::halloc::MemoryNode::next

Next node in memory sequence (doubly-linked list)

◆ parent

MemoryNode* hh::halloc::MemoryNode::parent

Parent node in Red-Black tree.

◆ prev

MemoryNode* hh::halloc::MemoryNode::prev

Previous node in memory sequence (doubly-linked list)

◆ right

MemoryNode* hh::halloc::MemoryNode::right

Right child in Red-Black tree.

◆ value

std::size_t hh::halloc::MemoryNode::value

Encoded value containing size, status, and color.

Layout:

  • Bit 63: Color (1=Red, 0=Black)
  • Bit 62: Status (1=Used, 0=Free)
  • Bits 0-61: Size in bytes

The documentation for this struct was generated from the following file: