Fixed comments
This commit is contained in:
parent
061102c778
commit
8bf37f3dd7
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
template<class T, size_t BufferSize>
|
template<class T, size_t NumElementsInReserve>
|
||||||
class cAllocationPool {
|
class cAllocationPool {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -32,14 +32,14 @@ class cAllocationPool {
|
|||||||
|
|
||||||
T* Allocate()
|
T* Allocate()
|
||||||
{
|
{
|
||||||
if (m_FreeList.size() <= BufferSize)
|
if (m_FreeList.size() <= NumElementsInReserve)
|
||||||
{
|
{
|
||||||
void * space = malloc(sizeof(T));
|
void * space = malloc(sizeof(T));
|
||||||
if (space != NULL)
|
if (space != NULL)
|
||||||
{
|
{
|
||||||
return new(space) T;
|
return new(space) T;
|
||||||
}
|
}
|
||||||
else if (m_FreeList.size() == BufferSize)
|
else if (m_FreeList.size() == NumElementsInReserve)
|
||||||
{
|
{
|
||||||
m_Callbacks->OnStartingUsingBuffer();
|
m_Callbacks->OnStartingUsingBuffer();
|
||||||
}
|
}
|
||||||
@ -64,7 +64,7 @@ class cAllocationPool {
|
|||||||
// placement destruct.
|
// placement destruct.
|
||||||
ptr->~T();
|
ptr->~T();
|
||||||
m_FreeList.push_front(ptr);
|
m_FreeList.push_front(ptr);
|
||||||
if (m_FreeList.size() == BufferSize)
|
if (m_FreeList.size() == NumElementsInReserve)
|
||||||
{
|
{
|
||||||
m_Callbacks->OnStopUsingBuffer();
|
m_Callbacks->OnStopUsingBuffer();
|
||||||
}
|
}
|
||||||
|
@ -30,9 +30,9 @@ template <typename T> inline bool IsAllValue(const T * a_Array, size_t a_NumElem
|
|||||||
cChunkData::cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600>& a_Pool) :
|
cChunkData::cChunkData(cAllocationPool<cChunkData::sChunkSection, 1600>& a_Pool) :
|
||||||
#if __cplusplus < 201103L
|
#if __cplusplus < 201103L
|
||||||
// auto_ptr style interface for memory management
|
// auto_ptr style interface for memory management
|
||||||
m_IsOwner(true)
|
m_IsOwner(true),
|
||||||
#endif
|
#endif
|
||||||
m_Pool(a_Pool)
|
m_Pool(a_Pool)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < NumSections; i++)
|
for (size_t i = 0; i < NumSections; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user