by::chunk Class Reference

Memory chunk for block-based allocation. More...

#include <chunk.hpp>

Inheritance diagram for by::chunk:
by::allocator by::memoryHaver by::watcher

Public Member Functions

 chunk (ncnt blockSz=1, ncnt sz=MIN_SZ)
 
void * operator[] (nidx n)
 
const void * operator[] (nidx n) const BY_CONST_FUNC(operator[](n))
 
void * get (nidx n)
 
void * new1 () override
 
nbool del (void *used, ncnt) override
 
ncnt len () const override
 
ncnt size () const override
 
nbool rel () override
 
nbool has (const instance &it) const override
 
- Public Member Functions inherited from by::allocator
 allocator (ncnt blksize=1)
 
ncnt getBlkSize () const
 
- Public Member Functions inherited from by::memoryHaver
nbool has (const instance *it) const BY_SIDE_FUNC(has)
 
nbool isFull () const
 
nbool isCapable () const
 

Static Public Attributes

static constexpr ncnt MIN_SZ = 20
 

Protected Member Functions

void * _get (nidx n) override
 
nuchar * _getHeap ()
 
const nuchar * _getHeap () const BY_CONST_FUNC(_getHeap()) nbool _resize(ncnt new Sz)
 

Friends

class watcher
 

Detailed Description

Memory chunk for block-based allocation.

Manages a contiguous block of memory divided into fixed-size blocks. Provides efficient allocation and deallocation within the chunk.

Member Function Documentation

◆ _get()

void * by::chunk::_get ( nidx  n)
overrideprotectedvirtual
Returns
returns regarding current size, not length. can return garbage if size is bigger than n.

Implements by::memoryHaver.

◆ del()

nbool by::chunk::del ( void *  used,
ncnt   
)
overridevirtual

Implements by::allocator.

◆ has()

nbool by::chunk::has ( const instance it) const
overridevirtual

Implements by::memoryHaver.

◆ len()

ncnt by::chunk::len ( ) const
overridevirtual

Implements by::memoryHaver.

◆ new1()

void * by::chunk::new1 ( )
overridevirtual

Implements by::allocator.

◆ rel()

nbool by::chunk::rel ( )
overridevirtual

Implements by::memoryHaver.

◆ size()

ncnt by::chunk::size ( ) const
overridevirtual

Implements by::memoryHaver.


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