aboutsummaryrefslogtreecommitdiff
path: root/common/memorypool.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/memorypool.cpp')
-rw-r--r--common/memorypool.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index 8bd7f802ca..16acf42c70 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -33,7 +33,7 @@ MemoryPool::MemoryPool(size_t chunkSize) {
MemoryPool::~MemoryPool() {
for(size_t i=0; i<_pages.size(); ++i)
- free(_pages[i]);
+ ::free(_pages[i]);
}
void* MemoryPool::malloc() {
@@ -83,12 +83,16 @@ void MemoryPool::freeUnusedPages() {
iterator = *(void**)iterator;
}
+ size_t freedPagesCount = 0;
for(size_t i=0; i<_pages.size(); ++i) {
if(numberOfFreeChunksPerPage[i] == CHUNK_PAGE_SIZE) {
- free(_pages[i]);
+ ::free(_pages[i]);
_pages[i] = NULL; // TODO : Remove NULL values
+ ++freedPagesCount;
}
}
+
+ printf("%d freed pages\n", freedPagesCount);
}
}