Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

l_mem.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void FreeMemory (void *ptr)
void * GetClearedMemory (int size)
void * GetMemory (unsigned long size)
int MemorySize (void *ptr)
void PrintMemorySize (unsigned long size)
int TotalAllocatedMemory (void)


Function Documentation

void FreeMemory void *  ptr  ) 
 

Definition at line 423 of file l_memory.c.

References allocedmemory, botimport, free(), botlib_import_s::FreeMemory, MemorySize(), and ptr().

Referenced by AAS_CalculateAreaTravelTimes(), AAS_ContinueInitReachability(), AAS_CreateReversedReachability(), AAS_DumpAASData(), AAS_DumpBSPData(), AAS_FreeAASLinkedEntities(), AAS_FreeAASLinkHeap(), AAS_FreeAllClusterAreaCache(), AAS_FreeAllPortalCache(), AAS_FreeBSPEntities(), AAS_FreeMaxAAS(), AAS_FreeRoutingCache(), AAS_FreeRoutingCaches(), AAS_FreeTmpAAS(), AAS_FreeTmpArea(), AAS_FreeTmpFace(), AAS_InitAASLinkedEntities(), AAS_InitAlternativeRouting(), AAS_InitAreaContentsTravelFlags(), AAS_InitClustering(), AAS_InitPortalMaxTravelTimes(), AAS_InitReachabilityAreas(), AAS_InitRoutingUpdate(), AAS_LoadAASLump(), AAS_OptimizeStore(), AAS_Setup(), AAS_Shutdown(), AAS_ShutdownAlternativeRouting(), AAS_ShutDownReachabilityHeap(), AAS_StoreReachability(), BotCheckInitialChatIntegrety(), BotCheckReplyChatIntegrety(), BotFreeCharacter2(), BotFreeCharacterStrings(), BotFreeChatFile(), BotFreeChatState(), BotFreeGoalState(), BotFreeInfoEntities(), BotFreeItemWeights(), BotFreeMatchPieces(), BotFreeMatchTemplates(), BotFreeMoveState(), BotFreeReplyChat(), BotFreeWeaponState(), BotFreeWeaponWeights(), BotInitInfoEntities(), BotLoadCharacterFromFile(), BotShutdownChatAI(), BotShutdownGoalAI(), BotShutdownMoveAI(), BotShutdownWeaponAI(), EA_Shutdown(), EndBSPFile(), FindMiptex(), FreeBrush(), FreeFace(), FreeFuzzySeperators_r(), FreePortal(), FreeScript(), FreeSource(), FreeValueKeys(), FreeWeightConfig2(), FreeWinding(), FS_FreeFile(), HL_FreeMaxBSP(), HL_LoadBSPFile(), Hunk_ClearHigh(), InitConsoleMessageHeap(), InitLevelItemHeap(), LibVarDeAlloc(), LibVarSet(), LoadItemConfig(), LoadScriptFile(), LoadWeaponConfig(), PC_DefineFromString(), PC_FreeDefine(), PC_FreeToken(), PC_PopIndent(), Q1_FreeMaxBSP(), Q1_LoadBSPFile(), Q2_FreeMaxBSP(), Q2_LoadBSPFile(), Q2_LoadBSPFileTexinfo(), Q2_MoveBrushesToWorld(), Q3_FreeMaxBSP(), Q3_LoadBSPFile(), QCopyFile(), ReadWeightConfig(), ResetMapLoading(), SetKeyValue(), Sin_FreeMaxBSP(), Sin_LoadBSPFile(), Sin_LoadBSPFileTexinfo(), TH_FreeMaxTH(), Tree_Free(), Tree_Free_r(), Tree_PruneNodes_r(), and Z_Free().

00424 {
00425     unsigned long int *memid;
00426 
00427     memid = (unsigned long int *) ((char *) ptr - sizeof(unsigned long int));
00428 
00429     if (*memid == MEM_ID)
00430     {
00431         botimport.FreeMemory(memid);
00432     } //end if
00433 } //end of the function FreeMemory

Here is the call graph for this function:

void* GetClearedMemory int  size  ) 
 

Definition at line 73 of file l_mem.c.

References allocedmemory, Error(), malloc(), MemorySize(), memset(), and ptr().

Referenced by AAS_AllocMaxAAS(), AAS_AllocRoutingCache(), AAS_AllocTmpArea(), AAS_AllocTmpFace(), AAS_AllocTmpNode(), AAS_CalculateAreaTravelTimes(), AAS_CreateAreaSettings(), AAS_CreateReversedReachability(), AAS_FloodAreas(), AAS_InitAreaContentsTravelFlags(), AAS_InitClusterAreaCache(), AAS_InitClustering(), AAS_InitPortalCache(), AAS_InitPortalMaxTravelTimes(), AAS_InitReachability(), AAS_InitReachabilityAreas(), AAS_InitRoutingUpdate(), AAS_LoadAASLump(), AAS_NearestHideArea(), AAS_OptimizeAlloc(), AAS_SetupReachabilityHeap(), AAS_StoreReachability(), BotAllocChatState(), BotAllocGoalState(), BotAllocMoveState(), BotAllocWeaponState(), BotCheckChatMessageIntegrety(), BotInitInfoEntities(), BotInterpolateCharacters(), BotLoadCharacterFromFile(), BotLoadChatFile(), BotLoadInitialChat(), Hunk_Alloc(), InitLevelItemHeap(), ItemWeightIndex(), LoadScriptFile(), LoadScriptMemory(), LoadSourceFile(), LoadSourceMemory(), PC_DefineFromString(), Q2_AllocMaxBSP(), Q3_CreatePlanarSurfacePlanes(), ReadFuzzySeperators_r(), ReadWeightConfig(), Sin_AllocMaxBSP(), TH_InitMaxTH(), WeaponWeightIndex(), and Z_Malloc().

00074 {
00075     void *ptr;
00076 
00077     ptr = (void *) malloc(size);
00078     if (!ptr) Error("out of memory");
00079     memset(ptr, 0, size);
00080     allocedmemory += MemorySize(ptr);
00081     return ptr;
00082 } //end of the function GetClearedMemory

Here is the call graph for this function:

void* GetMemory unsigned long  size  ) 
 

Definition at line 342 of file l_memory.c.

References allocedmemory, botimport, Error(), botlib_import_s::GetMemory, malloc(), MemorySize(), and ptr().

Referenced by AAS_InitAlternativeRouting(), AAS_ReadCache(), AAS_UpdateStringIndexes(), AllocBrush(), AllocFace(), AllocNode(), AllocPortal(), AllocWinding(), BotDefaultCharacteristics(), BotImport_GetMemory(), BotInterpolateCharacters(), BotLoadCharacterFromFile(), copystring(), GetClearedMemory(), HL_AllocMaxBSP(), LibVar(), LibVarAlloc(), LibVarSet(), LoadFile(), LoadQuakeFile(), LoadSourceFile(), LoadSourceMemory(), ParseEpair(), PC_AddBuiltinDefines(), PC_CopyDefine(), PC_CopyToken(), PC_Directive_define(), PC_PushIndent(), PS_CreatePunctuationTable(), Q1_AllocMaxBSP(), Q2_LoadBSPFileTexinfo(), Q2_MoveBrushesToWorld(), Q3_CopyLump(), SetKeyValue(), Sin_LoadBSPFileTexinfo(), Tree_Alloc(), and TryLoadFile().

00344 {
00345     void *ptr;
00346     unsigned long int *memid;
00347 
00348     ptr = botimport.GetMemory(size + sizeof(unsigned long int));
00349     if (!ptr) return NULL;
00350     memid = (unsigned long int *) ptr;
00351     *memid = MEM_ID;
00352     return (unsigned long int *) ((char *) ptr + sizeof(unsigned long int));
00353 } //end of the function GetMemory

Here is the call graph for this function:

int MemorySize void *  ptr  ) 
 

Definition at line 54 of file l_mem.c.

References ptr().

Referenced by AllocBrush(), AllocNode(), AllocPortal(), AllocWinding(), FreeBrush(), FreeMemory(), FreePortal(), FreeWinding(), GetClearedMemory(), GetMemory(), Tree_Free(), Tree_Free_r(), and Tree_FreePortals_r().

00055 {
00056 #if defined(WIN32) || defined(_WIN32)
00057     #ifdef __WATCOMC__
00058         //Intel 32 bits memory addressing, 16 bytes aligned
00059     return (_msize(ptr) + 15) >> 4 << 4;
00060     #else
00061     return _msize(ptr);
00062     #endif
00063 #else
00064     return 0;
00065 #endif
00066 } //end of the function MemorySize

Here is the call graph for this function:

void PrintMemorySize unsigned long  size  ) 
 

Definition at line 34 of file l_mem.c.

References Log_Print().

Referenced by AAS_AllocMaxAAS(), AAS_FreeMaxAAS(), HL_AllocMaxBSP(), HL_FreeMaxBSP(), Q1_AllocMaxBSP(), Q1_FreeMaxBSP(), Q2_AllocMaxBSP(), Q2_FreeMaxBSP(), Sin_AllocMaxBSP(), Sin_FreeMaxBSP(), and Tree_Free().

00035 {
00036     unsigned long number1, number2, number3;
00037     number1 = size >> 20;
00038     number2 = (size & 0xFFFFF) >> 10;
00039     number3 = (size & 0x3FF);
00040     if (number1) Log_Print("%ld MB", number1);
00041     if (number1 && number2) Log_Print(" and ");
00042     if (number2) Log_Print("%ld KB", number2);
00043     if (number2 && number3) Log_Print(" and ");
00044     if (number3) Log_Print("%ld bytes", number3);
00045 } //end of the function PrintFileSize

Here is the call graph for this function:

int TotalAllocatedMemory void   ) 
 

Definition at line 114 of file l_mem.c.

00115 {
00116     return allocedmemory;
00117 } //end of the function TotalAllocatedMemory


Generated on Thu Aug 25 12:54:24 2005 for Quake III Arena by  doxygen 1.3.9.1