src/CSLModels.cpp
float CSLModel::GarbageCollection (float, float, int, void*)
{
    UPDATE_CYCLE_NUM;               // DEBUG only: Store current cycle number in glob.xpCycleNum
    const float now = GetMiscNetwTime();
    // loop all models
    for (auto& p: glob.mapCSLModels) {
        CSLModel& mdl = p.second;
        // loaded, but reference counter zero, and timeout reached
        if (mdl.GetObjState() == OLS_AVAILABLE &&
            mdl.GetRefCnt() == 0 &&
            now - mdl.refZeroTs > GARBAGE_COLLECTION_TIMEOUT)
            // unload the object
            mdl.Unload();
    }
    
    return GARBAGE_COLLECTION_PERIOD;
}
// Static functions: Unload all objects which haven't been used for a while
Static functions: Unload all objects which haven't been used for a while
Static functions : Unload all objects which haven ' t been used for a while
float CSLModel::GarbageCollection (float, float, int, void*)
{
    UPDATE_CYCLE_NUM;               
    const float now = GetMiscNetwTime();
    for (auto& p: glob.mapCSLModels) {
        CSLModel& mdl = p.second;
        if (mdl.GetObjState() == OLS_AVAILABLE &&
            mdl.GetRefCnt() == 0 &&
            now - mdl.refZeroTs > GARBAGE_COLLECTION_TIMEOUT)
            mdl.Unload();
    }
    return GARBAGE_COLLECTION_PERIOD;
}
float CSLModel :: GarbageCollection ( float , float , int , void * ) { UPDATE_CYCLE_NUM ; const float now = GetMiscNetwTime ( ) ; for ( auto & p : glob . mapCSLModels ) { CSLModel & mdl = p . second ; if ( mdl . GetObjState ( ) == OLS_AVAILABLE && mdl . GetRefCnt ( ) == 0 && now - mdl . refZeroTs > GARBAGE_COLLECTION_TIMEOUT ) mdl . Unload ( ) ; } return GARBAGE_COLLECTION_PERIOD ; }
Static functions: Unload all objects which haven't been used for a while
Static functions : Unload all objects which haven ' t been used for a while
// DEBUG only: Store current cycle number in glob.xpCycleNum // loop all models // loaded, but reference counter zero, and timeout reached // unload the object