![]() |
DarkPlaces
Game engine based on the Quake 1 engine by id Software, developed by LadyHavoc
|
|
Go to the source code of this file.
Macros | |
#define | FILE_BACKED_MALLOC 0 |
#define | MEMCLUMPING 0 |
#define | MEMCLUMPING_FREECLUMPS 0 |
#define | MEMHEADER_SENTINEL_FOR_ADDRESS(p) |
Variables | |
cvar_t | developer_memory = {CF_CLIENT | CF_SERVER, "developer_memory", "0", "prints debugging information about memory allocations"} |
cvar_t | developer_memorydebug = {CF_CLIENT | CF_SERVER, "developer_memorydebug", "0", "enables memory corruption checks (very slow)"} |
cvar_t | developer_memoryreportlargerthanmb = {CF_CLIENT | CF_SERVER, "developer_memorylargerthanmb", "16", "prints debugging information about memory allocations over this size"} |
qbool | mem_bigendian = false |
void * | mem_mutex = NULL |
static mempool_t * | poolchain = NULL |
unsigned int | sentinel_seed |
cvar_t | sys_memsize_physical = {CF_CLIENT | CF_SERVER | CF_READONLY, "sys_memsize_physical", "", "physical memory size in MB (or empty if unknown)"} |
cvar_t | sys_memsize_virtual = {CF_CLIENT | CF_SERVER | CF_READONLY, "sys_memsize_virtual", "", "virtual memory size in MB (or empty if unknown)"} |
mempool_t * | tempmempool |
mempool_t * | zonemempool |
#define MEMHEADER_SENTINEL_FOR_ADDRESS | ( | p | ) |
Definition at line 31 of file zone.c.
Referenced by _Mem_Alloc(), _Mem_AllocPool(), _Mem_CheckSentinels(), _Mem_CheckSentinelsGlobal(), _Mem_EmptyPool(), _Mem_FreeBlock(), _Mem_FreePool(), Clump_AllocBlock(), and Clump_FreeBlock().
void * _Mem_Alloc | ( | mempool_t * | pool, |
void * | olddata, | ||
size_t | size, | ||
size_t | alignment, | ||
const char * | filename, | ||
int | fileline ) |
Definition at line 369 of file zone.c.
References _Mem_Free(), memheader_t::baseaddress, mempool_t::chain, Clump_AllocBlock(), Con_DPrintf(), developer_memory, developer_memoryreportlargerthanmb, memheader_t::fileline, memheader_t::filename, cvar_t::integer, memheader_t::list, List_Add(), mem_mutex, Mem_PrintList(), Mem_PrintStats(), MEMHEADER_SENTINEL_FOR_ADDRESS, min, mempool_t::name, NULL, olddata, memheader_t::pool, mempool_t::realsize, memheader_t::sentinel, memheader_t::size, size, Sys_Error(), Thread_LockMutex, Thread_UnlockMutex, mempool_t::totalsize, and cvar_t::value.
Referenced by _Mem_strdup().
mempool_t * _Mem_AllocPool | ( | const char * | name, |
unsigned | flags, | ||
mempool_t * | parent, | ||
const char * | filename, | ||
int | fileline ) |
Definition at line 500 of file zone.c.
References _Mem_CheckSentinelsGlobal(), mempool_t::chain, Clump_AllocBlock(), developer_memorydebug, dp_strlcpy, mempool_t::fileline, mempool_t::filename, flags, mempool_t::flags, cvar_t::integer, List_Create(), Mem_PrintList(), Mem_PrintStats(), MEMHEADER_SENTINEL_FOR_ADDRESS, mempool_t::name, name, mempool_t::next, NULL, mempool_t::parent, poolchain, mempool_t::realsize, mempool_t::sentinel1, mempool_t::sentinel2, Sys_Error(), and mempool_t::totalsize.
Definition at line 599 of file zone.c.
References data, memheader_t::fileline, memheader_t::filename, MEMHEADER_SENTINEL_FOR_ADDRESS, NULL, memheader_t::sentinel, memheader_t::size, and Sys_Error().
Referenced by _Mem_CheckSentinelsGlobal().
Definition at line 628 of file zone.c.
References _Mem_CheckSentinels(), mempool_t::chain, mempool_t::fileline, mempool_t::filename, List_For_Each_Entry, MEMHEADER_SENTINEL_FOR_ADDRESS, mempool_t::next, poolchain, mempool_t::sentinel1, mempool_t::sentinel2, and Sys_Error().
Referenced by _Mem_AllocPool(), and _Mem_FreePool().
Definition at line 567 of file zone.c.
References _Mem_EmptyPool(), _Mem_FreeBlock(), mempool_t::chain, developer_memorydebug, mempool_t::fileline, mempool_t::filename, cvar_t::integer, List_First_Entry, List_Is_Empty(), MEMHEADER_SENTINEL_FOR_ADDRESS, mempool_t::next, NULL, mempool_t::parent, poolchain, mempool_t::sentinel1, mempool_t::sentinel2, and Sys_Error().
Referenced by _Mem_EmptyPool().
Definition at line 482 of file zone.c.
References _Mem_FreeBlock(), Con_DPrintf(), data, developer_memorydebug, cvar_t::integer, Mem_IsAllocated(), NULL, and Sys_Error().
Referenced by _Mem_Alloc().
|
static |
Definition at line 447 of file zone.c.
References memheader_t::baseaddress, Clump_FreeBlock(), Con_DPrintf(), developer_memory, memheader_t::fileline, memheader_t::filename, cvar_t::integer, memheader_t::list, List_Delete(), mem_mutex, MEMHEADER_SENTINEL_FOR_ADDRESS, mempool_t::name, memheader_t::pool, mempool_t::realsize, memheader_t::sentinel, memheader_t::size, size, Sys_Error(), Thread_LockMutex, Thread_UnlockMutex, and mempool_t::totalsize.
Referenced by _Mem_EmptyPool(), _Mem_Free(), and _Mem_FreePool().
Definition at line 530 of file zone.c.
References _Mem_CheckSentinelsGlobal(), _Mem_FreeBlock(), _Mem_FreePool(), mempool_t::chain, Clump_FreeBlock(), developer_memorydebug, mempool_t::fileline, mempool_t::filename, cvar_t::integer, List_First_Entry, List_Is_Empty(), MEMHEADER_SENTINEL_FOR_ADDRESS, mempool_t::next, NULL, mempool_t::parent, poolchain, mempool_t::sentinel1, mempool_t::sentinel2, and Sys_Error().
Referenced by _Mem_FreePool().
Definition at line 865 of file zone.c.
References _Mem_Alloc(), dp_strlcpy, NULL, and strlen().
|
static |
Definition at line 147 of file zone.c.
References NULL, size, and Sys_Sleep().
Referenced by Clump_AllocBlock().
|
static |
Definition at line 202 of file zone.c.
References attempt_malloc(), developer_memorydebug, index, cvar_t::integer, mask, MEMHEADER_SENTINEL_FOR_ADDRESS, NULL, size, Sys_Error(), and value.
Referenced by _Mem_Alloc(), and _Mem_AllocPool().
Definition at line 316 of file zone.c.
References developer_memorydebug, cvar_t::integer, MEMHEADER_SENTINEL_FOR_ADDRESS, size, and Sys_Error().
Referenced by _Mem_FreeBlock(), and _Mem_FreePool().
void * Mem_ExpandableArray_AllocRecord | ( | memexpandablearray_t * | l | ) |
Definition at line 695 of file zone.c.
References memexpandablearray_array_t::allocflags, memexpandablearray_t::arrays, memexpandablearray_array_t::data, i, max, memexpandablearray_t::maxarrays, Mem_Alloc, Mem_Free, memexpandablearray_t::mempool, memexpandablearray_t::numarrays, memexpandablearray_array_t::numflaggedrecords, memexpandablearray_t::numrecordsperarray, and memexpandablearray_t::recordsize.
Referenced by BufStr_FindCreateReplace(), Mod_BSP_RecursiveNodePortals(), Mod_FindName(), Mod_LoadQ3Shaders(), Q3Shader_AddToHash(), R_GLSL_FindPermutation(), R_LoadTextureDDSFile(), R_LoadTextureRenderBuffer(), R_Mesh_CreateMeshBuffer(), R_RenderTarget_Get(), R_SetupTexture(), R_Shadow_NewWorldLight(), R_SkinFrame_Find(), VM_buf_create(), and W_LoadTextureWadFile().
void Mem_ExpandableArray_FreeArray | ( | memexpandablearray_t * | l | ) |
Definition at line 683 of file zone.c.
References memexpandablearray_t::arrays, memexpandablearray_array_t::data, i, memexpandablearray_t::maxarrays, Mem_Free, and memexpandablearray_t::numarrays.
Referenced by gl_backend_shutdown(), gl_main_shutdown(), Mod_BSP_MakePortals(), r_textures_shutdown(), and W_UnloadAll().
void Mem_ExpandableArray_FreeRecord | ( | memexpandablearray_t * | l, |
void * | record ) |
Definition at line 743 of file zone.c.
References memexpandablearray_array_t::allocflags, memexpandablearray_t::arrays, memexpandablearray_array_t::data, i, memexpandablearray_t::numarrays, memexpandablearray_array_t::numflaggedrecords, memexpandablearray_t::numrecordsperarray, memexpandablearray_t::recordsize, and Sys_Error().
Referenced by BufStr_Del(), Mod_PurgeUnused(), R_FreeTexture(), R_GLSL_Restart_f(), R_Mesh_DestroyMeshBuffer(), R_RenderTarget_FreeUnused(), and R_Shadow_FreeWorldLight().
size_t Mem_ExpandableArray_IndexRange | ( | const memexpandablearray_t * | l | ) |
Definition at line 763 of file zone.c.
References memexpandablearray_array_t::allocflags, memexpandablearray_t::arrays, i, memexpandablearray_t::numarrays, memexpandablearray_array_t::numflaggedrecords, and memexpandablearray_t::numrecordsperarray.
Referenced by BufStr_FindCreateReplace(), BufStr_Flush(), gl_backend_devicelost(), GL_Mesh_ListVBOs(), Mod_BSP_FinalizePortals(), Mod_ClearUsed(), Mod_FindName(), mod_newmap(), Mod_Print_f(), Mod_PurgeUnused(), Mod_Reload(), mod_shutdown(), mod_start(), PRVM_LeakTest(), R_CompleteLightPoint(), R_GLSL_Restart_f(), R_RenderTarget_FreeUnused(), R_RenderTarget_Get(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_CheckEnable(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_ClearWorldLights(), R_Shadow_DrawCoronas(), R_Shadow_DrawLightSprites(), R_Shadow_EditLights_DrawSelectedLightProperties(), R_Shadow_EditLights_EditAll_f(), R_Shadow_EditLights_Reload_f(), R_Shadow_GetRTLightInfo(), R_Shadow_PrepareLights(), R_Shadow_SaveWorldLights(), R_Shadow_SelectLightInView(), R_Shadow_UncompileWorldLights(), r_textures_devicelost(), r_textures_devicerestored(), SV_Loadgame_f(), SV_Savegame_to(), W_GetTextureBGRA(), and W_UnloadAll().
void Mem_ExpandableArray_NewArray | ( | memexpandablearray_t * | l, |
mempool_t * | mempool, | ||
size_t | recordsize, | ||
int | numrecordsperarray ) |
Definition at line 675 of file zone.c.
References memexpandablearray_t::mempool, memexpandablearray_t::numrecordsperarray, and memexpandablearray_t::recordsize.
Referenced by BufStr_Flush(), gl_backend_start(), gl_main_start(), Mod_BSP_MakePortals(), Mod_Init(), Mod_LoadQ3Shaders(), PRVM_Prog_Load(), R_Shadow_Init(), r_textures_start(), W_GetTextureBGRA(), and W_LoadTextureWadFile().
void * Mem_ExpandableArray_RecordAtIndex | ( | const memexpandablearray_t * | l, |
size_t | index ) |
Definition at line 780 of file zone.c.
References memexpandablearray_array_t::allocflags, memexpandablearray_t::arrays, memexpandablearray_array_t::data, i, index, NULL, memexpandablearray_t::numarrays, memexpandablearray_t::numrecordsperarray, and memexpandablearray_t::recordsize.
Referenced by BufStr_FindCreateReplace(), BufStr_Flush(), gl_backend_devicelost(), GL_Mesh_ListVBOs(), Mod_BSP_FinalizePortals(), Mod_ClearUsed(), Mod_FindName(), mod_newmap(), Mod_Print_f(), Mod_PurgeUnused(), Mod_Reload(), mod_shutdown(), mod_start(), PRVM_LeakTest(), R_BlendView(), R_CompleteLightPoint(), R_GLSL_Restart_f(), R_RenderTarget_FreeUnused(), R_RenderTarget_Get(), R_Shadow_BounceGrid_AssignPhotons_Task(), R_Shadow_BounceGrid_CheckEnable(), R_Shadow_BounceGrid_UpdateSpacing(), R_Shadow_ClearWorldLights(), R_Shadow_DrawCoronas(), R_Shadow_DrawLightSprites(), R_Shadow_EditLights_DrawSelectedLightProperties(), R_Shadow_EditLights_EditAll_f(), R_Shadow_GetRTLightInfo(), R_Shadow_PrepareLights(), R_Shadow_SaveWorldLights(), R_Shadow_SelectLightInView(), R_Shadow_UncompileWorldLights(), r_textures_devicelost(), r_textures_devicerestored(), SV_Loadgame_f(), SV_Savegame_to(), VM_buf_copy(), VM_buf_create(), VM_buf_cvarlist(), VM_buf_del(), VM_buf_getsize(), VM_buf_implode(), VM_buf_loadfile(), VM_buf_sort(), VM_buf_writefile(), VM_bufstr_add(), VM_bufstr_find(), VM_bufstr_free(), VM_bufstr_get(), VM_bufstr_set(), VM_uri_get(), W_GetTextureBGRA(), and W_UnloadAll().
Definition at line 652 of file zone.c.
References mempool_t::chain, data, List_For_Each_Entry, Mem_IsAllocated(), mempool_t::next, poolchain, and target.
Referenced by _Mem_Free(), and Mem_IsAllocated().
void Mem_PrintList | ( | size_t | minallocationsize | ) |
Definition at line 823 of file zone.c.
References mempool_t::chain, Con_Print(), Con_Printf(), memheader_t::fileline, memheader_t::filename, mempool_t::flags, mempool_t::lastchecksize, List_For_Each_Entry, Mem_CheckSentinelsGlobal, mempool_t::name, mempool_t::next, poolchain, POOLFLAG_TEMP, mempool_t::realsize, memheader_t::size, and mempool_t::totalsize.
Referenced by _Mem_Alloc(), _Mem_AllocPool(), and MemList_f().
Definition at line 798 of file zone.c.
References mempool_t::chain, Con_Printf(), CON_WARN, count, memheader_t::fileline, memheader_t::filename, mempool_t::flags, List_For_Each_Entry, List_Is_Empty(), Mem_CheckSentinelsGlobal, mempool_t::next, poolchain, POOLFLAG_TEMP, mempool_t::realsize, memheader_t::size, size, and mempool_t::totalsize.
Referenced by _Mem_Alloc(), _Mem_AllocPool(), MemList_f(), and MemStats_f().
|
static |
Definition at line 840 of file zone.c.
References cmd(), Cmd_Argc(), Cmd_Argv(), Con_Print(), Mem_PrintList(), and Mem_PrintStats().
Referenced by Memory_Init_Commands().
Definition at line 882 of file zone.c.
References b, Mem_AllocPool, mem_bigendian, mem_mutex, NULL, poolchain, POOLFLAG_TEMP, sentinel_seed, tempmempool, Thread_CreateMutex, Thread_HasThreads(), and zonemempool.
Referenced by Host_Init().
Definition at line 907 of file zone.c.
References buf, CF_SHARED, Cmd_AddCommand(), COM_ParseToken_Console(), com_token, Cvar_RegisterVariable(), Cvar_SetValueQuick(), developer_memory, developer_memorydebug, developer_memoryreportlargerthanmb, f, fclose(), fgets(), fopen(), MemList_f(), MemStats_f(), min, sys_memsize_physical, sys_memsize_virtual, and cvar_t::value.
Referenced by Host_Init().
Definition at line 897 of file zone.c.
References mem_mutex, NULL, and Thread_DestroyMutex.
Referenced by Host_Shutdown().
|
static |
Definition at line 858 of file zone.c.
References Mem_CheckSentinelsGlobal, and Mem_PrintStats().
Referenced by Memory_Init_Commands().
cvar_t developer_memory = {CF_CLIENT | CF_SERVER, "developer_memory", "0", "prints debugging information about memory allocations"} |
Definition at line 90 of file zone.c.
Referenced by _Mem_Alloc(), _Mem_FreeBlock(), Host_Init(), and Memory_Init_Commands().
cvar_t developer_memorydebug = {CF_CLIENT | CF_SERVER, "developer_memorydebug", "0", "enables memory corruption checks (very slow)"} |
Definition at line 91 of file zone.c.
Referenced by _Mem_AllocPool(), _Mem_EmptyPool(), _Mem_Free(), _Mem_FreePool(), Clump_AllocBlock(), Clump_FreeBlock(), Host_Init(), and Memory_Init_Commands().
cvar_t developer_memoryreportlargerthanmb = {CF_CLIENT | CF_SERVER, "developer_memorylargerthanmb", "16", "prints debugging information about memory allocations over this size"} |
Definition at line 34 of file zone.c.
Referenced by Memory_Init(), OGG_GetSamplesFloat(), OGG_LoadVorbisFile(), and S_LoadWavFile().
Definition at line 35 of file zone.c.
Referenced by _Mem_Alloc(), _Mem_FreeBlock(), Memory_Init(), and Memory_Shutdown().
Definition at line 96 of file zone.c.
Referenced by _Mem_AllocPool(), _Mem_CheckSentinelsGlobal(), _Mem_EmptyPool(), _Mem_FreePool(), Mem_IsAllocated(), Mem_PrintList(), Mem_PrintStats(), and Memory_Init().
unsigned int sentinel_seed |
Definition at line 32 of file zone.c.
Referenced by Memory_Init().
cvar_t sys_memsize_physical = {CF_CLIENT | CF_SERVER | CF_READONLY, "sys_memsize_physical", "", "physical memory size in MB (or empty if unknown)"} |
Definition at line 93 of file zone.c.
Referenced by Memory_Init_Commands().
cvar_t sys_memsize_virtual = {CF_CLIENT | CF_SERVER | CF_READONLY, "sys_memsize_virtual", "", "virtual memory size in MB (or empty if unknown)"} |
Definition at line 94 of file zone.c.
Referenced by Memory_Init_Commands().
mempool_t* tempmempool |
Definition at line 794 of file zone.c.
Referenced by AssertBufsize(), CheckPendingDownloads(), CL_Beams_SetupBuiltinTexture(), CL_CutDemo(), CL_IPLog_Load(), CL_Particles_LoadEffectInfo(), CL_ReadPointFile_f(), CL_StopDownload(), CL_VM_Init(), Cmd_AddInterpreter(), Cmd_CompleteAliasBuildList(), Cmd_CompleteBuildList(), Cmd_Exec(), Cmd_Init(), Con_ConDump_f(), Con_Init(), Curl_FindPackURL(), Cvar_CompleteBuildList(), decode_image(), fixtransparentpixels(), fractalnoise(), FS_CRCFile(), FS_Deflate(), FS_Inflate(), FS_Init_SelfPack(), FS_LoadPackPAK(), FS_Search(), FS_Seek(), FS_VPrintf(), GetMapList(), gl_main_newmap(), GrowBuf(), hmac(), Image_Compress(), Image_GenerateDitherPattern(), Image_GenerateNoTexture(), Image_GenerateWhite(), Image_GetEmbeddedPicBGRA(), Image_GetStockPicSize(), Image_Resample32Lerp(), Image_WriteTGABGRA(), JPEG_LoadImage_BGRA(), JPEG_SaveImage_to_Buffer(), listdirectory(), LoadConChars_BGRA(), LoadFont(), loadimagepixelsbgra(), LoadLMP_BGRA(), LoadPCX_BGRA(), LoadTGA_BGRA(), LoadWAL_BGRA(), Log_ConPrint(), M_Setup_Draw(), Memory_Init(), Mod_BuildBaseBonePoses(), Mod_BuildVBOs(), Mod_BuildVertexRemapTableFromElements(), Mod_GenerateLightmaps_CreateLightmaps(), Mod_GenerateLightmaps_CreateLights(), Mod_GenerateLightmaps_CreateLights_ComputeSVBSP(), Mod_IDP0_Load(), Mod_IDP2_Load(), Mod_LoadModel(), Mod_LoadQ3Shaders(), Mod_LoadSkinFiles(), Mod_MDLMD2MD3_TraceBox(), Mod_MDLMD2MD3_TraceLine(), Mod_OBJ_Load(), Mod_PSKMODEL_Load(), Mod_Q1BSP_LoadLighting(), Mod_Q1BSP_LoadMapBrushes(), Mod_Q1BSP_LoadSplitSky(), Mod_Q2BSP_LoadBrushes(), Mod_Q2BSP_LoadTexinfo(), Mod_Q3BSP_LoadBrushes(), Mod_Q3BSP_LoadFaces(), Mod_Q3BSP_LoadLightmaps(), Nicks_CompleteBuildList(), Palette_Load(), Palette_LoadQ2Colormap(), Palette_SetupSpecialPalettes(), PK3_BuildFileList(), PK3_GetEndOfCentralDir(), PNG_LoadImage_BGRA(), PRVM_Fields_f(), PRVM_LoadLNO(), R_BuildNormalizationCube(), R_Envmap_f(), R_InitBloodTextures(), R_InitParticleTexture(), R_LoadCubemap(), R_LoadQWSkin(), R_LoadSkyBox(), R_LoadTextureDDSFile(), R_SaveTextureDDSFile(), R_SetupTexture(), R_Shadow_LoadLightsFile(), R_Shadow_LoadWorldLights(), R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(), R_Shadow_MakeTextures(), R_Shadow_SaveWorldLights(), R_SkinFrame_GenerateTexturesFromQPixels(), R_SkinFrame_LoadExternal_SkinFrame(), R_SkinFrame_LoadInternalBGRA(), SCR_CaptureVideo_Avi_BeginVideo(), SCR_CaptureVideo_Ogg_BeginVideo(), SCR_DrawScreen(), SCR_ScreenShot_f(), SV_Loadgame_f(), SV_ParticleEffectIndex(), SV_ReadClientMessage(), SV_SpawnServer(), VM_CL_ReadPicture(), VM_loadfromfile(), W_ConvertWAD3TextureBGRA(), and W_GetTextureBGRA().
mempool_t* zonemempool |
Definition at line 796 of file zone.c.
Referenced by Cmd_RestoreInitState(), Cmd_SaveInitState(), Con_Init(), Key_History_Init(), Memory_Init(), and TaskQueue_Enqueue().