/* ==================== EndLevelLoad Free all samples marked as unused ==================== */ void idSoundCache::EndLevelLoad() { int useCount, purgeCount; common->Printf( "----- idSoundCache::EndLevelLoad -----\n" ); insideLevelLoad = false; // purge the ones we don't need useCount = 0; purgeCount = 0; for( int i = 0 ; i < listCache.Num() ; i++ ) { idSoundSample *sample = listCache[ i ]; if( !sample ) { continue; } if( sample->purged ) { continue; } if( !sample->levelLoadReferenced ) { // common->Printf( "Purging %s\n", sample->name.c_str() ); purgeCount += sample->objectMemSize; sample->PurgeSoundSample(); } else { useCount += sample->objectMemSize; } } soundCacheAllocator.FreeEmptyBaseBlocks(); common->Printf( "%5ik referenced\n", useCount / 1024 ); common->Printf( "%5ik purged\n", purgeCount / 1024 ); common->Printf( "----------------------------------------\n" ); }
/* ==================== BeginLevelLoad Mark all file based images as currently unused, but don't free anything. Calls to ImageFromFile() will either mark the image as used, or create a new image without loading the actual data. ==================== */ void idSoundCache::BeginLevelLoad() { insideLevelLoad = true; for( int i = 0 ; i < listCache.Num() ; i++ ) { idSoundSample *sample = listCache[ i ]; if( !sample ) { continue; } if( com_purgeAll.GetBool() ) { sample->PurgeSoundSample(); } sample->levelLoadReferenced = false; } soundCacheAllocator.FreeEmptyBaseBlocks(); }
/* ================ idStr::PurgeMemory ================ */ void idStr::PurgeMemory( void ) { #ifdef USE_STRING_DATA_ALLOCATOR stringDataAllocator.FreeEmptyBaseBlocks(); #endif }