aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBertrand Augereau2009-09-06 13:26:14 +0000
committerBertrand Augereau2009-09-06 13:26:14 +0000
commit9da3c5c7169fc8d3772917238a8c79d8f0ceea4b (patch)
treed409c43d67a65b92453396357bd25c8b28b12714
parenteb8cf07db2f134121120a9feed84f6ad98931704 (diff)
downloadscummvm-rg350-9da3c5c7169fc8d3772917238a8c79d8f0ceea4b.tar.gz
scummvm-rg350-9da3c5c7169fc8d3772917238a8c79d8f0ceea4b.tar.bz2
scummvm-rg350-9da3c5c7169fc8d3772917238a8c79d8f0ceea4b.zip
COMMON: (Inactive) code to debug memory leaks in memory pools + typo fix
svn-id: r43990
-rw-r--r--common/memorypool.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/common/memorypool.cpp b/common/memorypool.cpp
index d5dcbcc8c8..16485949b2 100644
--- a/common/memorypool.cpp
+++ b/common/memorypool.cpp
@@ -46,6 +46,12 @@ MemoryPool::MemoryPool(size_t chunkSize) {
}
MemoryPool::~MemoryPool() {
+#if 0
+ freeUnusedPages();
+ if (!_pages.empty())
+ warning("Memory leak found in pool");
+#endif
+
for (size_t i = 0; i < _pages.size(); ++i)
::free(_pages[i].start);
}
@@ -62,7 +68,7 @@ void MemoryPool::allocPage() {
_pages.push_back(page);
- // Next time, we'll alocate a page twice as big as this one.
+ // Next time, we'll allocate a page twice as big as this one.
_chunksPerPage *= 2;
// Add the page to the pool of free chunk