void TexDictionary::clear(void) { // We remove the links of all textures inside of us. while ( LIST_EMPTY( this->textures.root ) == false ) { TextureBase *texture = LIST_GETITEM( TextureBase, this->textures.root.next, texDictNode ); // Call the texture's own removal. texture->RemoveFromDictionary(); } }
TexDictionary::~TexDictionary( void ) { // Delete all textures that are part of this dictionary. while ( LIST_EMPTY( this->textures.root ) == false ) { TextureBase *theTexture = LIST_GETITEM( TextureBase, this->textures.root.next, texDictNode ); // Remove us from this TXD. // This is done because we cannot be sure that the texture is actually destroyed. theTexture->RemoveFromDictionary(); // Delete us. this->engineInterface->DeleteRwObject( theTexture ); } }
inline static void _win32_shutdownHeap( void ) { // Make sure the DebugHeap manager is not damaged. LIST_VALIDATE( g_privateMemory.root ); #ifdef PAGE_HEAP_MEMORY_STATS // Memory debugging statistics. unsigned int blockCount = 0; unsigned int pageCount = 0; size_t memLeaked = 0; #endif //PAGE_HEAP_MEMORY_STATS // Check all blocks in order and free them while ( !LIST_EMPTY( g_privateMemory.root ) ) { _memIntro *item = LIST_GETITEM( _memIntro, g_privateMemory.root.next, memList ); #ifdef PAGE_HEAP_MEMORY_STATS // Keep track of stats. blockCount++; pageCount += MEM_PAGE_MOD( item->objSize + sizeof(_memIntro) + sizeof(_memOutro) ); memLeaked += item->objSize; #endif //PAGE_HEAP_MEMORY_STATS _win32_freeMem( item + 1 ); } #ifdef PAGE_HEAP_MEMORY_STATS if ( blockCount != 0 ) { OutputDebugString( "Heap Memory Leak Protocol:\n" ); OutputDebugStringFormat( "* leaked memory: %u\n" \ "* blocks/pages allocated: %u/%u [%u]\n", memLeaked, blockCount, pageCount, blockCount * g_systemInfo.dwPageSize ); } else OutputDebugString( "No memory leaks detected." ); #endif //PAGE_HEAP_MEMORY_STATS }