2
3
4
5
10#include "Core/Container/SpanList.h"
11#include "Core/Container/RadixTrie.h"
17
18
19
25
26
30
31
35
36
37
41
42
43
47
48
49
53
54
55
56
60
61
62
63
67
68
69
75
76
77
78
84
85
89
90
94
95
99
100
104
105
CentralCache()=default
Constructor Function.
static scl::span * GetOneSpan(scl::span_list &list, size_t size)
Get a not empty span.
size_t FetchRange(void *&start, void *&end, size_t batchNum, size_t size)
Fetch range memory to tc.
static CentralCache m_CentralCache
Single instance of this.
CentralCache & operator=(const CentralCache &)=delete
Copy Assignment Operation.
virtual ~CentralCache()=default
Destructor Function.
void ReleaseListToSpans(void *start, size_t size)
Release memory to pc.
std::array< scl::span_list, MemoryPool::FREE_LIST_NUM > m_SpanLists
FreeList Array.
CentralCache(const CentralCache &)=delete
Copy Constructor Function.
static CentralCache * Get()
Get this single Instance.
Central memory cache. Second level of memory allocator.
static void *& PointerSpace(void *obj)
Get object first 4/8 bytes as a pointer.
ObjectPool Class. Specific situation(Fixed size of block) of MemoryPool.
scl::radix_trie< 64 - MemoryPool::PAGE_SHIFT, 3 > m_IdSpanMap
radix trie for [pageId - span]
virtual ~PageCache()=default
Destructor Function.
PageCache & operator=(const PageCache &)=delete
Copy Assignment Operation.
static PageCache m_PageCache
this single instance.
PageCache()=default
Constructor Function.
scl::span * MapObjectToSpan(void *obj) const
Find span by memory pointer.
scl::span * InternalNewSpan(size_t k)
Fetch pages span(internal call).
static PageCache * Get()
Get this single instance.
void ReleaseSpanToPageCache(scl::span *s)
Release span from cc to pc,.
std::mutex m_Mutex
mutex for pc.
scl::span * NewSpan(size_t k)
Fetch pages span.
ObjectPool< scl::span > m_SpanPool
ObjectPool for span.
PageCache(const PageCache &)=delete
Copy Constructor Function.
std::array< scl::span_list, MemoryPool::PAGE_NUM > m_SpanLists
FreeList Array.
Page memory cache. Third level of memory allocator.
void PushFront(span *s)
Push a span to this list.
span * Begin() const
Get begin pointer.
span * End() const
Get end pointer.
Bidirectional cyclic linked list for span.
void * m_FreeList
current pointer.
bool m_IsUse
True if in use.
Used for manage multiple page memory.