summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AllocationPool.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/AllocationPool.h b/src/AllocationPool.h
index f1e324953..d14d56f7a 100644
--- a/src/AllocationPool.h
+++ b/src/AllocationPool.h
@@ -36,12 +36,15 @@ class AllocationPool {
}
}
}
- T* ret = m_FreeList.front();
+ // placement new, used to initalize the object
+ T* ret = new (m_FreeList.front()) T;
m_FreeList.pop_front();
return ret;
}
void Free(T* ptr)
{
+ // placement destruct.
+ ptr->~T();
m_FreeList.push_front(ptr);
if (m_FreeList.size() == BufferSize)
{
@@ -50,5 +53,5 @@ class AllocationPool {
}
private:
- std::list<T*> m_FreeList;
+ std::list<void *> m_FreeList;
}