SpiecsEngine
 
Loading...
Searching...
No Matches

◆ Deallocate()

void Spices::ThreadCache::Deallocate ( void * obj,
size_t size )

Recycle object memory.

Parameters
[in]objobject pointer.
[in]sizeobject bytes.

Push object memory to free list.

Release memory to cc.

Push object memory to free list.

Release memory to cc.

Definition at line 58 of file ThrealCache.cpp.

59 {
60 assert(obj);
61 assert(size <= MemoryPool::MAX_BYTES);
62
66 const size_t index = MemoryPool::Index(size);
67 m_FreeLists[index].Push(obj);
68
72 if (m_FreeLists[index].Size() >= m_FreeLists[index].ApplyforNBlocks())
73 {
74 ReleaseToCentralCache(m_FreeLists[index], size, m_FreeLists[index].ApplyforNBlocks());
75 }
76 }
static constexpr size_t MAX_BYTES
Only allowed 256KB allocated memory one time in tc.
Definition MemoryPool.h:34
static size_t Index(size_t size)
Determine which freelist should process the memory block with given bytes.
std::array< scl::free_list, MemoryPool::FREE_LIST_NUM > m_FreeLists
FreeList Array.
Definition ThrealCache.h:81
static void ReleaseToCentralCache(scl::free_list &list, size_t size, size_t count)
Release memory to cc.