Memory chunk for block-based allocation 더 자세히 ...
#include <chunk.hpp>
Public 멤버 함수 | |
| 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 |
| Checks if this chunk contains the memory allocated for the given instance. | |
by::allocator(으)로부터 상속된 Public 멤버 함수 | |
| allocator (ncnt blksize=1) | |
| ncnt | getBlkSize () const |
by::memoryHaver(으)로부터 상속된 Public 멤버 함수 | |
| nbool | has (const instance *it) const BY_SIDE_FUNC(has) |
| nbool | isFull () const |
| nbool | isCapable () const |
정적 Public 속성 | |
| static constexpr ncnt | MIN_SZ = 20 |
Protected 멤버 함수 | |
| void * | _get (nidx n) override |
| nuchar * | _getHeap () |
| const nuchar * | _getHeap () const BY_CONST_FUNC(_getHeap()) nbool _resize(ncnt new Sz) |
Memory chunk for block-based allocation
The minimum unit class that can actually allocate memory in memlite. All memory management is performed by linking chunks together.
chunk receives blockSize and size at creation. blockSize is the minimum unit size one instance occupies in memory. size defines how many such instances can fit. For example, to create a chunk holding 100 int64 values:
Actual memory allocation uses real block size instead of block size for optimization. Rather than allocating in small 1 or 2 byte units during CPU operations, it's more efficient to allocate minimum bytes appropriate for the CPU level, like 4 or 8 bytes.
chunk is implemented as an ArrayList. Size is fixed, but addition and deletion are free within size limits, with very fast random access.
Algorithm: 0. Precondition: Each element's byte size must be >= 4. All elements have identical byte sizes. Since chunk handles everything as void*, elements without values are treated as int type.
1 from _heap[0], meaning next new1() treats _heap[1] as available empty element.
|
overrideprotectedvirtual |
by::memoryHaver를 구현.
|
overridevirtual |
by::allocator를 구현.
by::watcher에서 재구현되었습니다.
Checks if this chunk contains the memory allocated for the given instance.
| it | The instance whose memory location is to be checked. |
by::memoryHaver를 구현.
|
overridevirtual |
by::memoryHaver를 구현.
|
overridevirtual |
by::allocator를 구현.
|
overridevirtual |
by::memoryHaver를 구현.
|
overridevirtual |
by::memoryHaver를 구현.