Fixed flushOldestExcessiveBlocks().

This commit is contained in:
David Williams 2013-07-23 13:31:24 +02:00
parent 7146b5ecdb
commit 7c11a53484

View File

@ -775,12 +775,11 @@ namespace PolyVox
void LargeVolume<VoxelType>::flushOldestExcessiveBlocks(void) const void LargeVolume<VoxelType>::flushOldestExcessiveBlocks(void) const
{ {
const uint32_t uMemoryUsedForCompressedBlocks = calculateBlockMemoryUsage(); const uint32_t uMemoryUsedForCompressedBlocks = calculateBlockMemoryUsage();
//uint32_t uMemoryToReclaim = uMemoryUsedForCompressedBlocks - m_uCompressedBlockMemoryLimitInBytes;
//while(uMemoryToReclaim > 0) while(m_pBlocks.size() > m_uMaxNumberOfBlocksInMemory)
/*while(calculateBlockMemoryUsage() > m_uCompressedBlockMemoryLimitInBytes) //FIXME - This calculation of size is slow and should be outside the loop.
{ {
// find the least recently used block // Find the least recently used block. This is somewhat inefficient as it searches through
// the map, so if it proves to be a bottleneck we may want some kind of sorted structure.
typename CompressedBlockMap::iterator i; typename CompressedBlockMap::iterator i;
typename CompressedBlockMap::iterator itUnloadBlock = m_pBlocks.begin(); typename CompressedBlockMap::iterator itUnloadBlock = m_pBlocks.begin();
for(i = m_pBlocks.begin(); i != m_pBlocks.end(); i++) for(i = m_pBlocks.begin(); i != m_pBlocks.end(); i++)
@ -791,12 +790,9 @@ namespace PolyVox
} }
} }
//POLYVOX_ASSERT(itUnloadBlock->second.hasUncompressedData() == false, "This function should never flush blocks with uncompressed data."); // Erase the least recently used block
//uMemoryToReclaim -= itUnloadBlock->second->calculateSizeInBytes();
eraseBlock(itUnloadBlock); eraseBlock(itUnloadBlock);
}*/ }
} }
template <typename VoxelType> template <typename VoxelType>