Memory handling with sentinel checking and pools with tags for grouped free'ing. More...
Go to the source code of this file.
Data Structures | |
struct | memBlockFoot_s |
struct | memBlock_s |
struct | memPool_s |
Defines | |
#define | MEM_MAX_POOLNAME 64 |
#define | MEM_HASH 11 |
#define | Mem_CreatePool(name) _Mem_CreatePool((name),__FILE__,__LINE__) |
#define | Mem_DeletePool(pool) _Mem_DeletePool((pool),__FILE__,__LINE__) |
#define | Mem_Free(ptr) _Mem_Free((ptr),__FILE__,__LINE__) |
#define | Mem_FreeTag(pool, tagNum) _Mem_FreeTag((pool),(tagNum),__FILE__,__LINE__) |
#define | Mem_FreePool(pool) _Mem_FreePool((pool),__FILE__,__LINE__) |
#define | Mem_Alloc(size) _Mem_Alloc((size),qtrue,com_genericPool,0,__FILE__,__LINE__) |
#define | Mem_AllocExt(size, zeroFill) _Mem_Alloc((size),(zeroFill),com_genericPool,0,__FILE__,__LINE__) |
#define | Mem_PoolAlloc(size, pool, tagNum) _Mem_Alloc((size),qtrue,(pool),(tagNum),__FILE__,__LINE__) |
#define | Mem_PoolAllocExt(size, zeroFill, pool, tagNum) _Mem_Alloc((size),(zeroFill),(pool),(tagNum),__FILE__,__LINE__) |
#define | Mem_ReAlloc(ptr, size) _Mem_ReAlloc((ptr),(size),__FILE__,__LINE__) |
#define | Mem_Dup(in, size) _Mem_PoolDup((in),(size),com_genericPool,0,__FILE__,__LINE__) |
#define | Mem_StrDup(in) _Mem_PoolStrDup((in),com_genericPool,0,__FILE__,__LINE__) |
#define | Mem_PoolStrDupTo(in, out, pool, tagNum) _Mem_PoolStrDupTo((in),(out),(pool),(tagNum),__FILE__,__LINE__) |
#define | Mem_PoolStrDup(in, pool, tagNum) _Mem_PoolStrDup((in),(pool),(tagNum),__FILE__,__LINE__) |
#define | Mem_PoolSize(pool) _Mem_PoolSize((pool)) |
#define | Mem_TagSize(pool, tagNum) _Mem_TagSize((pool),(tagNum)) |
#define | Mem_ChangeTag(pool, tagFrom, tagTo) _Mem_ChangeTag((pool),(tagFrom),(tagTo)) |
#define | Mem_CheckPoolIntegrity(pool) _Mem_CheckPoolIntegrity((pool),__FILE__,__LINE__) |
#define | Mem_CheckGlobalIntegrity() _Mem_CheckGlobalIntegrity(__FILE__,__LINE__) |
#define | Mem_TouchPool(pool) _Mem_TouchPool((pool),__FILE__,__LINE__) |
#define | Mem_TouchGlobal() _Mem_TouchGlobal(__FILE__,__LINE__) |
Typedefs | |
typedef struct memBlockFoot_s | memBlockFoot_t |
typedef struct memBlock_s | memBlock_t |
typedef struct memPool_s | memPool_t |
Functions | |
memPool_t * | _Mem_CreatePool (const char *name, const char *fileName, const int fileLine) __attribute__((malloc)) |
uint32_t | _Mem_DeletePool (memPool_t *pool, const char *fileName, const int fileLine) |
uint32_t | _Mem_Free (void *ptr, const char *fileName, const int fileLine) |
uint32_t | _Mem_FreeTag (memPool_t *pool, const int tagNum, const char *fileName, const int fileLine) |
Free memory blocks assigned to a specified tag within a pool. | |
uint32_t | _Mem_FreePool (memPool_t *pool, const char *fileName, const int fileLine) |
Free all items within a pool. | |
void * | _Mem_Alloc (size_t size, qboolean zeroFill, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine) __attribute__((malloc)) |
Optionally returns 0 filled memory allocated in a pool with a tag. | |
void * | _Mem_ReAlloc (void *ptr, size_t size, const char *fileName, const int fileLine) |
size_t | Mem_Size (const void *ptr) |
char * | _Mem_PoolStrDupTo (const char *in, char **out, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine) |
Saves a string to client hunk. | |
void * | _Mem_PoolDup (const void *in, size_t size, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine) |
char * | _Mem_PoolStrDup (const char *in, memPool_t *pool, const int tagNum, const char *fileName, const int fileLine) __attribute__((malloc)) |
No need to null terminate the extra spot because Mem_Alloc returns zero-filled memory. | |
uint32_t | _Mem_PoolSize (memPool_t *pool) |
uint32_t | _Mem_TagSize (memPool_t *pool, const int tagNum) |
uint32_t | _Mem_ChangeTag (memPool_t *pool, const int tagFrom, const int tagTo) |
void | _Mem_CheckPoolIntegrity (memPool_t *pool, const char *fileName, const int fileLine) |
void | _Mem_CheckGlobalIntegrity (const char *fileName, const int fileLine) |
void | _Mem_TouchPool (memPool_t *pool, const char *fileName, const int fileLine) |
void | _Mem_TouchGlobal (const char *fileName, const int fileLine) |
void * | _Mem_AllocatedInPool (memPool_t *pool, const void *pointer) |
void | Mem_Init (void) |
uint32_t | Mem_Shutdown (void) |
Memory handling with sentinel checking and pools with tags for grouped free'ing.
Definition in file mem.h.
#define Mem_Alloc | ( | size | ) | _Mem_Alloc((size),qtrue,com_genericPool,0,__FILE__,__LINE__) |
Definition at line 76 of file mem.h.
Referenced by AllocBrush(), AllocFace(), AllocNode(), AllocPortal(), AllocTree(), AllocWinding(), ASE_GetSurfaceAnimation(), ASE_Load(), BuildFacelights(), BuildLights(), BuildPatch(), CalcLightinfoVectors(), Cbuf_AddLateCommands(), Cbuf_InsertText(), Check_ExtraBrushesForWorldspawn(), Check_FindCompositeSides(), Check_NearList(), Check_Stats(), CL_QueueHTTPDownload(), Cmd_Exec_f(), HTTP_Recv(), Irc_Proto_Enqueue(), LoadJPG(), LoadPNG(), LoadTGA(), MakeTracingNodes(), MoveBrushesToWorld(), ParseEpair(), R_CreateFramebuffer(), R_InitFBObjects(), SetKeyValue(), SubdividePatch(), SV_AssembleMap(), SV_ParallelSearch(), TryLoadJPG(), TryLoadPNG(), TryLoadTGA(), UI_TextNodeGenerateLineSplit(), and WriteTGA24().
#define Mem_AllocExt | ( | size, | |||
zeroFill | ) | _Mem_Alloc((size),(zeroFill),com_genericPool,0,__FILE__,__LINE__) |
#define Mem_ChangeTag | ( | pool, | |||
tagFrom, | |||||
tagTo | ) | _Mem_ChangeTag((pool),(tagFrom),(tagTo)) |
Definition at line 88 of file mem.h.
Referenced by R_SwitchModelMemPoolTag().
#define Mem_CheckGlobalIntegrity | ( | ) | _Mem_CheckGlobalIntegrity(__FILE__,__LINE__) |
Definition at line 91 of file mem.h.
Referenced by Qcommon_Init().
#define Mem_CheckPoolIntegrity | ( | pool | ) | _Mem_CheckPoolIntegrity((pool),__FILE__,__LINE__) |
Definition at line 70 of file mem.h.
Referenced by CL_InitMemPools(), CP_InitStartup(), main(), Qcommon_Init(), SV_Init(), SV_InitGameProgs(), TEST_Init(), UI_Init(), and VID_Init().
#define Mem_DeletePool | ( | pool | ) | _Mem_DeletePool((pool),__FILE__,__LINE__) |
Definition at line 71 of file mem.h.
Referenced by Mem_Shutdown(), and SV_ShutdownGameProgs().
#define Mem_Dup | ( | in, | |||
size | ) | _Mem_PoolDup((in),(size),com_genericPool,0,__FILE__,__LINE__) |
Definition at line 82 of file mem.h.
Referenced by MD2GLCmdsRemove(), and MD2SkinFix().
#define Mem_Free | ( | ptr | ) | _Mem_Free((ptr),__FILE__,__LINE__) |
Definition at line 73 of file mem.h.
Referenced by AIR_PostLoadInitMissions(), ASE_FreeGeomObject(), BuildFacelights(), Cbuf_AddLateCommands(), Cbuf_InsertText(), Check_Free(), Check_InitEntityDefs(), Check_SidesOverlap(), Check_Stats(), CIN_OGM_StopCinematic(), CIN_ROQ_PlayCinematic(), CIN_ROQ_StopCinematic(), CL_ActorCleanup(), CL_ExecuteBattlescapeEvent(), CL_FilterEventQueue(), CL_FreeBattlescapeEvent(), CL_HTTP_Cleanup(), CL_ParseFileList(), CL_PingServers_f(), CL_QueryMasterServerThread(), CL_SetHTTPServer(), CloseTracingNodes(), Cmd_Alias_f(), Cmd_BufClear(), Cmd_Exec_f(), Cmd_RemoveCommand(), Com_UnregisterConstVariable(), CP_CreateBattleParameters(), Cvar_Delete(), Cvar_FixCheatVars(), Cvar_FullSet(), Cvar_Get(), Cvar_Set2(), Cvar_UnRegisterChangeListener(), EndOfScript(), free_dbuffer(), free_element(), FreeBrush(), FreeFace(), FreeInventory(), FreePatches(), FreePortal(), FreeTree(), FreeTree_r(), FreeWinding(), FS_AddGameDirectory(), FS_BuildFileList(), FS_CopyFile(), FS_GetMaps(), FS_Shutdown(), GAME_FreeInventory(), HTTP_Recv(), Irc_Client_CmdRplNamreply(), Irc_Logic_RemoveChannelName(), Irc_Proto_Disconnect(), Irc_Proto_DrainBucket(), Key_SetBinding(), LIST_Delete(), LIST_RemoveEntry(), LoadJPG(), MAP_Init(), Master_HeartbeatThread(), Master_Shutdown(), MD2GLCmdsRemove(), MD2SkinFix(), MoveBrushesToWorld(), MP_LoadTeamMultiplayer(), MP_SaveTeamMultiplayer(), NET_DatagramSocketClose(), NET_StreamClose(), NET_Wait(), Qcommon_Frame(), R_BuildLightmap(), R_DeleteFBObject(), R_ImageClearMaterials(), R_LoadMaterials(), R_LoadObjModel(), R_LoadShader(), R_ModCalcUniqueNormalsAndTangents(), R_ModelLoadDPMVertsForFrame(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), R_ModReloadSurfacesArrays(), R_PreprocessShader(), R_ScreenShot(), R_ShutdownFBObjects(), R_SoftenTexture(), R_SortSurfacesArrays(), R_UploadData(), R_UploadTexture(), S_FreeSamples(), SAV_GameLoad(), SAV_GameSave(), SEQ_ExecuteRemove(), SetKeyValue(), SV_AssembleMap(), SV_Map(), SV_MapcycleClear(), SV_ParallelSearch(), SV_SetMaster_f(), SV_Shutdown(), testAssembly(), testMassAssemblyParallel(), testMassAssemblySequential(), testMassAssemblyTimeout(), TryLoadJPG(), TryLoadPNG(), TryLoadTGA(), UI_AbstractValueDelete(), UI_CloneCvarOrFloat(), UI_DrawModelNode(), UI_FreeRadarImages(), UI_FreeStringProperty(), UI_MaterialEditorRemoveStage_f(), UI_ModelNodeDelete(), UI_PopupList(), UI_RemoveListener(), UI_SetOneButton(), UI_Shutdown(), UI_TextNodeGenerateLineSplit(), WriteMapFile(), and WriteTGA24().
#define Mem_FreePool | ( | pool | ) | _Mem_FreePool((pool),__FILE__,__LINE__) |
Definition at line 75 of file mem.h.
Referenced by CL_ResetSinglePlayerData(), CM_LoadMap(), FS_Shutdown(), R_ShutdownModels(), and UI_Shutdown().
#define Mem_FreeTag | ( | pool, | |||
tagNum | ) | _Mem_FreeTag((pool),(tagNum),__FILE__,__LINE__) |
Definition at line 74 of file mem.h.
Referenced by FreeAllInventory(), GAME_FreeAllInventory(), R_ShutdownModels(), and S_Shutdown().
#define MEM_HASH 11 |
Definition at line 30 of file mem.h.
Referenced by _Mem_Alloc(), _Mem_AllocatedInPool(), _Mem_ChangeTag(), _Mem_CheckPoolIntegrity(), _Mem_CreatePool(), _Mem_Free(), _Mem_FreePool(), _Mem_FreeTag(), _Mem_TagSize(), and _Mem_TouchPool().
#define MEM_MAX_POOLNAME 64 |
Definition at line 29 of file mem.h.
Referenced by _Mem_CreatePool().
#define Mem_PoolAlloc | ( | size, | |||
pool, | |||||
tagNum | ) | _Mem_Alloc((size),qtrue,(pool),(tagNum),__FILE__,__LINE__) |
Definition at line 78 of file mem.h.
Referenced by allocate_element(), AllocInventoryMemory(), CIN_OGM_PlayCinematic(), CIN_ROQ_DecodeInfo(), CIN_ROQ_PlayCinematic(), CL_ActorAddToTeamList(), CL_GetEventMail(), CL_ParseEvent(), CL_ParseLanguages(), CL_ParseTipsOfTheDay(), CM_MakeTracingNodes(), Cmd_AddCommand(), Cmd_Alias_f(), CMod_LoadBrushes(), CMod_LoadBrushSides(), CMod_LoadLeafBrushes(), CMod_LoadLeafs(), CMod_LoadLighting(), CMod_LoadNodes(), CMod_LoadPlanes(), CMod_LoadSubmodels(), CMod_LoadSurfaces(), Com_ParseTerrain(), Com_RegisterConstInt(), Cvar_Get(), Cvar_GetChangeListener(), FS_AddGameDirectory(), FS_BuildFileList(), FS_CopyFile(), FS_GetMaps(), FS_ListFiles(), FS_LoadPackFile(), GAME_AllocInventoryMemory(), Irc_Client_CmdRplNamreply(), Irc_Logic_AddChannelName(), LIST_Add(), LIST_AddPointer(), LIST_AddString(), LoadModel(), main(), MP_LoadTeamMultiplayer(), MP_SaveTeamMultiplayer(), MS_AddNewMessageSound(), NET_DatagramSend(), NET_DatagramSocketDoNew(), NET_StreamNew(), new_dbuffer(), R_BeginBuildingLightmaps(), R_BuildLightmap(), R_CreateSurfaceFlare(), R_LoadBspVertexArrays(), R_LoadImage(), R_LoadImageData(), R_LoadMaterials(), R_LoadObjModel(), R_LoadObjModelVertexArrays(), R_LoadObjSkin(), R_LoadShader(), R_LoadSurfacesArrays_(), R_ModCalcUniqueNormalsAndTangents(), R_ModelLoadDPMVertsForFrame(), R_ModLoadAliasDPMModel(), R_ModLoadAliasMD2Mesh(), R_ModLoadAliasMD2MeshIndexed(), R_ModLoadAliasMD2MeshUnindexed(), R_ModLoadAliasMD3Model(), R_ModLoadAnims(), R_ModLoadArrayData(), R_ModLoadEdges(), R_ModLoadLeafs(), R_ModLoadLighting(), R_ModLoadMDX(), R_ModLoadNodes(), R_ModLoadPlanes(), R_ModLoadSubmodels(), R_ModLoadSurfaces(), R_ModLoadSurfedges(), R_ModLoadTags(), R_ModLoadTexinfo(), R_ModLoadVertexes(), R_PreprocessShader(), R_ScreenShot(), R_SortSurfacesArrays(), R_SphereGenerate(), S_LoadSample(), SAV_GameLoad(), SAV_GameSave(), Schedule_Event(), Schedule_Timer(), SV_InitGame(), SV_MapcycleAdd(), UI_AbstractValueNew(), UI_AddListener(), UI_AllocNodeWithoutNew(), UI_DrawModelNode(), UI_Init(), UI_MaterialEditorNewStage_f(), UI_ModelNodeNew(), UI_PoolAllocAction(), and UI_WindowNodeAddIndexedNode().
#define Mem_PoolAllocExt | ( | size, | |||
zeroFill, | |||||
pool, | |||||
tagNum | ) | _Mem_Alloc((size),(zeroFill),(pool),(tagNum),__FILE__,__LINE__) |
Definition at line 79 of file mem.h.
Referenced by R_SoftenTexture(), R_UploadData(), and R_UploadTexture().
#define Mem_PoolSize | ( | pool | ) | _Mem_PoolSize((pool)) |
Definition at line 86 of file mem.h.
Referenced by SV_ShutdownGameProgs().
#define Mem_PoolStrDup | ( | in, | |||
pool, | |||||
tagNum | ) | _Mem_PoolStrDup((in),(pool),(tagNum),__FILE__,__LINE__) |
Definition at line 85 of file mem.h.
Referenced by AIR_LoadAircraftXML(), AIR_ParseAircraft(), B_ParseBaseTemplate(), B_ParseBuildings(), CL_AddServerToList(), CL_EventAddMail_f(), CL_NewEventMail(), CL_ParseCampaignEvents(), CL_ParseCities(), CL_ParseCustomSkin(), CL_ParseEventMails(), CL_ParseLanguages(), CL_ParseMapDefinition(), CL_ParseNations(), CL_ParseRanks(), CL_ParseResearchedCampaignItems(), CL_ParseTipsOfTheDay(), CL_ParticleAppear(), Cmd_Alias_f(), Cmd_TokenizeString(), Com_ParseTerrain(), Com_ParseUGVs(), CP_CreateBattleParameters(), Cvar_FixCheatVars(), Cvar_FullSet(), Cvar_Get(), Cvar_Set2(), FS_ListFiles(), INS_ParseInstallations(), Key_SetBinding(), M_ParseMusic(), MS_AddNewMessageSound(), MSO_ParseCategories(), RS_InitTree(), RS_ParseTechnologies(), S_LoadSample(), SV_LoadModelMinsMaxs(), SV_MapcycleAdd(), UI_AddListener(), UI_NodeSetProperty(), UI_ParseFont(), UI_ParseUIModel(), UI_PoolAllocAction(), and UP_ParseChapters().
#define Mem_PoolStrDupTo | ( | in, | |||
out, | |||||
pool, | |||||
tagNum | ) | _Mem_PoolStrDupTo((in),(out),(pool),(tagNum),__FILE__,__LINE__) |
Definition at line 84 of file mem.h.
Referenced by AIR_ParseAircraft(), B_ParseBuildings(), CL_ParseCampaignEvents(), CL_ParseCities(), CL_ParseEventMails(), CL_ParseMapDefinition(), CL_ParseNations(), CL_ParseRanks(), Com_ParseTerrain(), INS_ParseInstallations(), RS_ParseTechnologies(), SEQ_Execute2Dobj(), UI_ParseFont(), and UI_ParseUIModel().
Definition at line 80 of file mem.h.
Referenced by R_ModLoadAliasMD2Mesh().
#define Mem_StrDup | ( | in | ) | _Mem_PoolStrDup((in),com_genericPool,0,__FILE__,__LINE__) |
Definition at line 83 of file mem.h.
Referenced by Com_RegisterConstInt(), LIST_AddString(), ParseEpair(), SetKeyValue(), UI_BuildRadarImageList(), and UI_InitRadar().
#define Mem_TagSize | ( | pool, | |||
tagNum | ) | _Mem_TagSize((pool),(tagNum)) |
#define Mem_TouchGlobal | ( | ) | _Mem_TouchGlobal(__FILE__,__LINE__) |
Definition at line 94 of file mem.h.
Referenced by CL_Init(), and Qcommon_Init().
#define Mem_TouchPool | ( | pool | ) | _Mem_TouchPool((pool),__FILE__,__LINE__) |
typedef struct memBlock_s memBlock_t |
typedef struct memBlockFoot_s memBlockFoot_t |
void* _Mem_Alloc | ( | size_t | size, | |
qboolean | zeroFill, | |||
memPool_t * | pool, | |||
const int | tagNum, | |||
const char * | fileName, | |||
const int | fileLine | |||
) |
Optionally returns 0 filled memory allocated in a pool with a tag.
Definition at line 262 of file mem.c.
References memBlock_s::allocFile, memBlock_s::allocLine, memPool_s::blockCount, memPool_s::blocks, memBlock_s::botSentinel, byte, memPool_s::byteCount, memBlock_s::footer, MEM_FOOT_SENTINEL, MEM_HASH, MEM_HEAD_SENTINEL_BOT, MEM_HEAD_SENTINEL_TOP, memBlock_s::memPointer, memBlock_s::memSize, memBlock_s::next, memBlock_s::pool, memBlockFoot_s::sentinel, memBlock_s::size, Sys_Error(), memBlock_s::tagNum, memBlock_s::topSentinel, UFO_SIZE_T, and z_lock.
Referenced by _Mem_PoolDup(), _Mem_PoolStrDup(), _Mem_ReAlloc(), FS_LoadFile(), and SV_TagAlloc().
void* _Mem_AllocatedInPool | ( | struct memPool_s * | pool, | |
const void * | pointer | |||
) |
Searches a given pointer in all memory pool blocks
pool | The pool to search the pointer in | |
pointer | The pointer to search in the pool |
Definition at line 559 of file mem.c.
References memPool_s::blocks, MEM_HASH, memBlock_s::memPointer, and memBlock_s::next.
Referenced by UI_FreeStringProperty(), and UI_ResetData().
Definition at line 450 of file mem.c.
References memPool_s::blocks, MEM_HASH, memBlock_s::next, and memBlock_s::tagNum.
void _Mem_CheckGlobalIntegrity | ( | const char * | fileName, | |
const int | fileLine | |||
) |
Definition at line 519 of file mem.c.
References _Mem_CheckPoolIntegrity(), i, memPool_s::inUse, and m_numPools.
void _Mem_CheckPoolIntegrity | ( | memPool_t * | pool, | |
const char * | fileName, | |||
const int | fileLine | |||
) |
Definition at line 474 of file mem.c.
References memBlock_s::allocFile, memBlock_s::allocLine, memPool_s::blockCount, memPool_s::blocks, memBlock_s::botSentinel, memPool_s::byteCount, memBlock_s::footer, MEM_FOOT_SENTINEL, MEM_HASH, MEM_HEAD_SENTINEL_BOT, MEM_HEAD_SENTINEL_TOP, memPool_s::name, memBlock_s::next, memBlock_s::pool, memBlockFoot_s::sentinel, memBlock_s::size, Sys_Error(), and memBlock_s::topSentinel.
Referenced by _Mem_CheckGlobalIntegrity().
memPool_t* _Mem_CreatePool | ( | const char * | name, | |
const char * | fileName, | |||
const int | fileLine | |||
) |
Definition at line 67 of file mem.c.
References memPool_s::blockCount, memPool_s::blocks, memPool_s::byteCount, Com_Printf(), memPool_s::createFile, memPool_s::createLine, i, memPool_s::inUse, m_numPools, Mem_FindPool(), MEM_HASH, MEM_MAX_POOLCOUNT, MEM_MAX_POOLNAME, memPool_s::name, Q_strncpyz(), qtrue, and Sys_Error().
Definition at line 112 of file mem.c.
References _Mem_FreePool(), memPool_s::inUse, memPool_s::name, and qfalse.
uint32_t _Mem_Free | ( | void * | ptr, | |
const char * | fileName, | |||
const int | fileLine | |||
) |
Definition at line 164 of file mem.c.
References _Mem_CheckSentinels(), memPool_s::blockCount, memPool_s::blocks, byte, memPool_s::byteCount, MEM_HASH, memBlock_s::next, memBlock_s::pool, memBlock_s::size, and z_lock.
Referenced by _Mem_FreePool(), _Mem_FreeTag(), _Mem_ReAlloc(), FS_FreeFile(), and SV_MemFree().
Free all items within a pool.
Definition at line 236 of file mem.c.
References _Mem_Free(), memPool_s::blockCount, memPool_s::blocks, memPool_s::byteCount, MEM_HASH, memBlock_s::memPointer, memBlock_s::next, and next.
Referenced by _Mem_DeletePool().
uint32_t _Mem_FreeTag | ( | memPool_t * | pool, | |
const int | tagNum, | |||
const char * | fileName, | |||
const int | fileLine | |||
) |
Free memory blocks assigned to a specified tag within a pool.
Definition at line 209 of file mem.c.
References _Mem_Free(), memPool_s::blocks, MEM_HASH, memBlock_s::memPointer, memBlock_s::next, next, and memBlock_s::tagNum.
Referenced by SV_FreeTags().
void* _Mem_PoolDup | ( | const void * | in, | |
size_t | size, | |||
memPool_t * | pool, | |||
const int | tagNum, | |||
const char * | fileName, | |||
const int | fileLine | |||
) |
Definition at line 387 of file mem.c.
References _Mem_Alloc(), and qfalse.
[in] | pool | The pool to get the size from |
Definition at line 420 of file mem.c.
References memPool_s::byteCount.
char* _Mem_PoolStrDup | ( | const char * | in, | |
struct memPool_s * | pool, | |||
const int | tagNum, | |||
const char * | fileName, | |||
const int | fileLine | |||
) |
No need to null terminate the extra spot because Mem_Alloc returns zero-filled memory.
[in] | in | String to store in the given pool |
[in] | pool | The pool to allocate the memory in |
[in] | tagNum | |
[in] | fileName | The filename where this function was called from |
[in] | fileLine | The line where this function was called from |
Definition at line 407 of file mem.c.
References _Mem_Alloc(), and qtrue.
Referenced by _Mem_PoolStrDupTo().
char* _Mem_PoolStrDupTo | ( | const char * | in, | |
char ** | out, | |||
struct memPool_s * | pool, | |||
const int | tagNum, | |||
const char * | fileName, | |||
const int | fileLine | |||
) |
Saves a string to client hunk.
[in] | in | String to store in the given pool |
[out] | out | The location where you want the pool pointer to be stored |
[in] | pool | The pool to allocate the memory in |
[in] | tagNum | |
[in] | fileName | The filename where this function was called from |
[in] | fileLine | The line where this function was called from |
Definition at line 379 of file mem.c.
References _Mem_PoolStrDup().
void* _Mem_ReAlloc | ( | void * | ptr, | |
size_t | size, | |||
const char * | fileName, | |||
const int | fileLine | |||
) |
Definition at line 317 of file mem.c.
References _Mem_Alloc(), _Mem_CheckSentinels(), _Mem_Free(), byte, memBlock_s::memSize, memBlock_s::pool, qfalse, Sys_Error(), and memBlock_s::tagNum.
Definition at line 429 of file mem.c.
References memPool_s::blocks, MEM_HASH, memBlock_s::next, memBlock_s::size, and memBlock_s::tagNum.
void _Mem_TouchGlobal | ( | const char * | fileName, | |
const int | fileLine | |||
) |
Definition at line 579 of file mem.c.
References _Mem_TouchPool(), i, memPool_s::inUse, and m_numPools.
void _Mem_TouchPool | ( | memPool_t * | pool, | |
const char * | fileName, | |||
const int | fileLine | |||
) |
Definition at line 531 of file mem.c.
References memPool_s::blocks, byte, i, MEM_HASH, memBlock_s::memPointer, memBlock_s::memSize, and memBlock_s::next.
Referenced by _Mem_TouchGlobal().
void Mem_Init | ( | void | ) |
Definition at line 683 of file mem.c.
References Cmd_AddCommand(), and z_lock.
Referenced by main(), Qcommon_Init(), and TEST_Init().
uint32_t Mem_Shutdown | ( | void | ) |
Definition at line 698 of file mem.c.
References memPool_s::inUse, Mem_DeletePool, and z_lock.
Referenced by Exit(), main(), Qcommon_Shutdown(), Sys_Error(), Sys_Quit(), and TEST_Shutdown().
size_t Mem_Size | ( | const void * | ptr | ) |
[in] | ptr | The ptr to get the allocated size from |
Definition at line 364 of file mem.c.
References byte, and memBlock_s::size.