void Hunk_Clear( void ) { #ifndef DEDICATED CL_ShutdownCGame(); CL_ShutdownUI(); #endif SV_ShutdownGameProgs(); #ifndef DEDICATED CIN_CloseAllVideos(); #endif hunk_tag = TAG_HUNK_MARK1; Z_TagFree(TAG_HUNK_MARK1); Z_TagFree(TAG_HUNK_MARK2); if ( re.HunkClearCrap ) { re.HunkClearCrap(); } // Com_Printf( "Hunk_Clear: reset the hunk ok\n" ); VM_Clear(); //See if any ghoul2 stuff was leaked, at this point it should be all cleaned up. #ifdef _FULL_G2_LEAK_CHECKING assert(g_Ghoul2Allocations == 0 && g_G2ClientAlloc == 0 && g_G2ServerAlloc == 0); if (g_Ghoul2Allocations) { Com_Printf("%i bytes leaked by ghoul2 routines (%i client, %i server)\n", g_Ghoul2Allocations, g_G2ClientAlloc, g_G2ServerAlloc); G2_DEBUG_ReportLeaks(); } #endif }
void SV_ClearLastLevel(void) { Menu_Reset(); Z_TagFree(TAG_G_ALLOC); Z_TagFree(TAG_UI_ALLOC); G_FreeRoffs(); R_ModelFree(); Music_Free(); Sys_IORequestQueueClear(); AS_FreePartial(); G_ASPreCacheFree(); Ghoul2InfoArray_Free(); G2_FreeRag(); ClearAllNavStructures(); ClearModelsAlreadyDone(); CL_FreeServerCommands(); CL_FreeReliableCommands(); CM_Free(); ShaderEntryPtrs_Clear(); numVehicles = 0; if (svs.clients) { SV_FreeClient( svs.clients ); } }
/* ================= Hunk_Clear The server calls this before shutting down or loading a new map ================= */ void Hunk_Clear( void ) { Z_TagFree(TAG_HUNKALLOC); Z_TagFree(TAG_HUNKMISCMODELS); extern void CIN_CloseAllVideos(); CIN_CloseAllVideos(); if(re.R_ClearStuffToStopGhoul2CrashingThings) re.R_ClearStuffToStopGhoul2CrashingThings(); }
void Hunk_Clear(void) { Z_TagFree(TAG_TEMP_HUNKALLOC); Z_TagFree(TAG_HUNKALLOC); /* Z_TagFree(TAG_HUNKALLOC); Z_TagFree(TAG_BSP_HUNK); Z_TagFree(TAG_BOT_HUNK); Z_TagFree(TAG_RENDERER_HUNK); Z_TagFree(TAG_SKELETON); Z_TagFree(TAG_MODEL_OTHER); Z_TagFree(TAG_MODEL_CHAR); VM_Clear(); */ }
void Com_ShutdownZoneMemory(void) { assert(s_Initialized); // Remove commands Cmd_RemoveCommand("zone_stats"); Cmd_RemoveCommand("zone_details"); Cmd_RemoveCommand("zone_memmap"); if (s_Stats.m_CountAlloc) { // Free all memory // CM_ReleaseVisData(); Z_TagFree(TAG_ALL); } // Clear some globals memset(&s_Stats, 0, sizeof(s_Stats)); memset(s_FreeOverflow, 0, sizeof(s_FreeOverflow)); s_LastOverflowIndex = 0; s_LinkBase = NULL; // Free the pool #ifndef _GAMECUBE GlobalFree(s_PoolBase); CloseHandle(s_Mutex); #endif s_PoolBase = NULL; s_Initialized = false; }
/* ================= Hunk_Clear The server calls this before shutting down or loading a new map ================= */ void Hunk_Clear( void ) { Z_TagFree(TAG_HUNKALLOC); extern void CIN_CloseAllVideos(); CIN_CloseAllVideos(); extern void R_ClearStuffToStopGhoul2CrashingThings(void); R_ClearStuffToStopGhoul2CrashingThings(); }
// Shuts down the zone memory system and frees up all memory void Com_ShutdownZoneMemory(void) { // Com_Printf("Shutting down zone memory .....\n"); Cmd_RemoveCommand("zone_stats"); Cmd_RemoveCommand("zone_details"); if(TheZone.Stats.iCount) { Com_Printf("Automatically freeing %d blocks making up %d bytes\n", TheZone.Stats.iCount, TheZone.Stats.iCurrent); Z_TagFree(TAG_ALL); assert(!TheZone.Stats.iCount); assert(!TheZone.Stats.iCurrent); } }
static void Z_MemRecoverTest_f(void) { // needs to be in _DEBUG only, not good for final game! // fixme: findmeste: Remove this sometime // int iTotalMalloc = 0; while (1) { int iThisMalloc = 5* (1024 * 1024); Z_Malloc(iThisMalloc, TAG_SPECIAL_MEM_TEST, qfalse); // and lose, just to consume memory iTotalMalloc += iThisMalloc; if (gbMemFreeupOccured) break; } Z_TagFree(TAG_SPECIAL_MEM_TEST); }
// Shuts down the zone memory system and frees up all memory void Com_ShutdownZoneMemory(void) { Cmd_RemoveCommand("zone_stats"); Cmd_RemoveCommand("zone_details"); #ifdef _DEBUG Cmd_RemoveCommand("zone_memrecovertest"); #endif #ifdef DEBUG_ZONE_ALLOCS Cmd_RemoveCommand("zone_tagdebug"); Cmd_RemoveCommand("zone_snapshot"); #endif if(TheZone.Stats.iCount) { //Com_Printf("Automatically freeing %d blocks making up %d bytes\n", TheZone.Stats.iCount, TheZone.Stats.iCurrent); Z_TagFree(TAG_ALL); assert(!TheZone.Stats.iCount); assert(!TheZone.Stats.iCurrent); } }
static void Z_MemRecoverTest_f(void) { // needs to be in _DEBUG only, not good for final game! // if ( Cmd_Argc() != 2 ) { Com_Printf( "Usage: zone_memrecovertest max2alloc\n" ); return; } int iMaxAlloc = 1024*1024*atoi( Cmd_Argv(1) ); int iTotalMalloc = 0; while (1) { const int iThisMalloc = 5* (1024 * 1024); Z_Malloc(iThisMalloc, TAG_SPECIAL_MEM_TEST, qfalse); // and lose, just to consume memory iTotalMalloc += iThisMalloc; if (gbMemFreeupOccured || (iTotalMalloc >= iMaxAlloc) ) break; } Z_TagFree(TAG_SPECIAL_MEM_TEST); }
/* ================= Hunk_ClearToMark The client calls this before starting a vid_restart or snd_restart ================= */ void Hunk_ClearToMark( void ) { Z_TagFree(TAG_HUNKALLOC); Z_TagFree(TAG_HUNKMISCMODELS); }
/* ================= Hunk_ClearToMark The client calls this before starting a vid_restart or snd_restart ================= */ void Hunk_ClearToMark( void ) { Z_TagFree(TAG_HUNKALLOC); }
/* ================= Hunk_ClearTempMemory The temp space is no longer needed. If we have left more touched but unused memory on this side, have future permanent allocs use this side. ================= */ void Hunk_ClearTempMemory( void ) { Z_TagFree(TAG_TEMP_HUNKALLOC); }
/* ================= Hunk_ClearToMark The client calls this before starting a vid_restart or snd_restart ================= */ void Hunk_ClearToMark( void ) { assert(hunk_tag == TAG_HUNK_MARK2); //if this is not true then no mark has been made Z_TagFree(TAG_HUNK_MARK2); }
void Com_ShutdownHunkMemory(void) { //Er, ok. Clear it then I guess. Z_TagFree(TAG_HUNK_MARK1); Z_TagFree(TAG_HUNK_MARK2); }