로딩중...
검색중...
일치하는것 없음
chunk.hpp
이 파일의 문서화 페이지로 가기
1
2#pragma once
3
5
6namespace by {
7
57 class _nout chunk: public allocator {
58 BY_ME(chunk, allocator)
59 BY_INIT_META(me)
60
61 public:
62 // chunk:
63 static constexpr ncnt MIN_SZ = 20;
64
65 public:
66 explicit chunk(ncnt blockSz = 1, ncnt sz = MIN_SZ);
67 ~chunk();
68
69 public:
70 void* operator[](nidx n);
71 const void* operator[](nidx n) const BY_CONST_FUNC(operator[](n));
72
73 public:
74 void* get(nidx n) { return _get(n); }
75
76 // allocator:
77 void* new1() override;
78 nbool del(void* used, ncnt) override;
79 // MemoryHaver:
80 ncnt len() const override;
81 ncnt size() const override;
82 nbool rel() override;
83
84 using super::has;
90 nbool has(const instance& it) const override;
91
92 protected:
97 void* _get(nidx n) override;
98 nuchar* _getHeap();
99 const nuchar* _getHeap() const BY_CONST_FUNC(_getHeap())
100 nbool _resize(ncnt newSz);
101
102 private:
103 // chunk:
104 const nuchar* _getEOB() const BY_CONST_FUNC(_getEOB())
105 nuchar* _getEOB();
106 nbool _index(nidx start);
107 ncnt _getRealBlkSize();
108 void* _allocHeap(ncnt new_sz);
109 nbool _freeHeap(nuchar** heap);
110
111 nidx _head;
112 ncnt _len, _sz;
113 nuchar* _heap;
114 };
115} // namespace by
Abstract allocator interface for memory management
Definition allocator.hpp:21
Memory chunk for block-based allocation
Definition chunk.hpp:57
nbool has(const instance &it) const override
Checks if this chunk contains the memory allocated for the given instance.
void * _get(nidx n) override
Base class for all managed instances in memlite system
Definition instance.hpp:41
Rich logging support with polymorphic type conversion
Definition richLog.hpp:34