로딩중...
검색중...
일치하는것 없음
by::chunks 클래스 참조

Collection of memory chunks for scalable allocation 더 자세히 ...

#include <chunks.hpp>

by::chunks에 대한 상속 다이어그램 :
by::allocator by::memoryHaver

Public 멤버 함수

 chunks (ncnt blkbyte=0)
 
chunkoperator[] (nidx n)
 
const chunkoperator[] (nidx n) const BY_CONST_FUNC(operator[](n))
 
chunkoperator[] (const instance &it)
 
const chunkoperator[] (const instance &it) const BY_CONST_FUNC(operator[](it))
 
chunkget (nidx n)
 
chunkget (const instance &it)
 
chunkget (const instance *it) BY_SIDE_FUNC(get)
 
const chunkget (nidx n) const BY_CONST_FUNC(get(n)) const chunk *get(const instance &it) const BY_CONST_FUNC(get(it)) const chunk *get(const instance *it) const BY_CONST_FUNC(get(it)) void *new 1() override
 
nbool del (void *pt, ncnt sz) override
 
virtual nbool resize (ncnt new1)
 
nbool has (const instance &it) const override
 Checks if any of the managed chunks contain the memory allocated for the given instance.
 
ncnt len () const override
 
ncnt size () const override
 
nbool rel () override
 
- by::allocator(으)로부터 상속된 Public 멤버 함수
 allocator (ncnt blksize=1)
 
virtual void * new1 ()=0
 
ncnt getBlkSize () const
 
- by::memoryHaver(으)로부터 상속된 Public 멤버 함수
nbool has (const instance *it) const BY_SIDE_FUNC(has)
 
nbool isFull () const
 
nbool isCapable () const
 

추가로 상속된 멤버들

상세한 설명

Collection of memory chunks for scalable allocation

Manages multiple chunk instances. Since chunk uses only fixed-size memory created at initialization, chunks adds/removes multiple chunks to manage memory dynamically.

chunks also provides only fixed memory

Since chunks adds or removes chunks, and each chunk cell uses only fixed size, chunks can also only allocate fixed-size memory.

Coordination with pool

The first to receive memory requests is pool class. When pool receives a memory size to allocate, it lazily retrieves a chunks instance capable of handling that memory size and requests new1(). chunks::new1() finds a chunk capable of allocating memory, and if none exists, creates an additional chunk.

Available chunk search algorithm

The most recently memory-allocated chunk has the highest probability of being able to allocate additionally. Member variable _s holds the index of the most recently allocated chunk. If _chunks[_s] has no available memory, increment _s. Like a circular array, _chunks' end connects to its beginning. If _s loops back to its pre-traversal value and still no available memory exists, the entire chunks has no available memory, so enters resize().

Remarks
Cannot use vector Obviously, vector is managed on heap, so shouldn't use vector while making a custom memory pool. Planned for future modification.

멤버 함수 문서화

◆ del()

nbool by::chunks::del ( void * pt,
ncnt sz )
overridevirtual

by::allocator를 구현.

◆ has()

nbool by::chunks::has ( const instance & it) const
overridevirtual

Checks if any of the managed chunks contain the memory allocated for the given instance.

매개변수
itThe instance whose memory location is to be checked.
반환값
true if the instance's memory is within any of this chunks' child chunks, false otherwise.

by::memoryHaver를 구현.

◆ len()

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

by::memoryHaver를 구현.

◆ rel()

nbool by::chunks::rel ( )
overridevirtual

by::memoryHaver를 구현.

◆ resize()

virtual nbool by::chunks::resize ( ncnt new1)
virtual
Remarks
chunk can resize its data. but can't persist whole memory allocated before, it's a kind of memory flashing and can't give a way for accessing it. at outside, ptr for them should be daggled.

◆ size()

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

by::memoryHaver를 구현.


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: