Skip to content
Snippets Groups Projects
Commit f6d79270 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Got rid of the memset.

parent bfa16936
No related branches found
No related tags found
No related merge requests found
...@@ -53,8 +53,7 @@ ...@@ -53,8 +53,7 @@
using namespace CPlusPlus; using namespace CPlusPlus;
MemoryPool::MemoryPool() MemoryPool::MemoryPool()
: _initializeAllocatedMemory(true), : _blocks(0),
_blocks(0),
_allocatedBlocks(0), _allocatedBlocks(0),
_blockCount(-1), _blockCount(-1),
_ptr(0), _ptr(0),
...@@ -79,12 +78,6 @@ void MemoryPool::reset() ...@@ -79,12 +78,6 @@ void MemoryPool::reset()
_ptr = _end = 0; _ptr = _end = 0;
} }
bool MemoryPool::initializeAllocatedMemory() const
{ return _initializeAllocatedMemory; }
void MemoryPool::setInitializeAllocatedMemory(bool initializeAllocatedMemory)
{ _initializeAllocatedMemory = initializeAllocatedMemory; }
void *MemoryPool::allocate_helper(size_t size) void *MemoryPool::allocate_helper(size_t size)
{ {
assert(size < BLOCK_SIZE); assert(size < BLOCK_SIZE);
...@@ -106,9 +99,6 @@ void *MemoryPool::allocate_helper(size_t size) ...@@ -106,9 +99,6 @@ void *MemoryPool::allocate_helper(size_t size)
if (! block) if (! block)
block = (char *) std::malloc(BLOCK_SIZE); block = (char *) std::malloc(BLOCK_SIZE);
if (_initializeAllocatedMemory)
std::memset(block, '\0', BLOCK_SIZE);
_ptr = block; _ptr = block;
_end = _ptr + BLOCK_SIZE; _end = _ptr + BLOCK_SIZE;
...@@ -130,8 +120,6 @@ RecursiveMemoryPool::~RecursiveMemoryPool() ...@@ -130,8 +120,6 @@ RecursiveMemoryPool::~RecursiveMemoryPool()
_pool->_blockCount = _blockCount; _pool->_blockCount = _blockCount;
_pool->_ptr = _ptr; _pool->_ptr = _ptr;
_pool->_end = _end; _pool->_end = _end;
std::memset(_pool->_ptr, 0, _pool->_end - _pool->_ptr);
} }
Managed::Managed() Managed::Managed()
......
...@@ -66,9 +66,6 @@ public: ...@@ -66,9 +66,6 @@ public:
MemoryPool(); MemoryPool();
~MemoryPool(); ~MemoryPool();
bool initializeAllocatedMemory() const;
void setInitializeAllocatedMemory(bool initializeAllocatedMemory);
void reset(); void reset();
inline void *allocate(size_t size) inline void *allocate(size_t size)
...@@ -86,7 +83,6 @@ private: ...@@ -86,7 +83,6 @@ private:
void *allocate_helper(size_t size); void *allocate_helper(size_t size);
private: private:
bool _initializeAllocatedMemory;
char **_blocks; char **_blocks;
int _allocatedBlocks; int _allocatedBlocks;
int _blockCount; int _blockCount;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment