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

g_mem.c File Reference

#include "g_local.h"

Include dependency graph for g_mem.c:

Include dependency graph

Go to the source code of this file.

Defines

#define POOLSIZE   (256 * 1024)

Functions

void * G_Alloc (int size)
void G_InitMemory (void)
void Svcmd_GameMem_f (void)

Variables

int allocPoint
char memoryPool [POOLSIZE]


Define Documentation

#define POOLSIZE   (256 * 1024)
 

Definition at line 31 of file g_mem.c.

Referenced by G_Alloc(), and Svcmd_GameMem_f().


Function Documentation

void* G_Alloc int  size  ) 
 

Definition at line 36 of file g_mem.c.

References allocPoint, g_debugAlloc, G_Error(), G_Printf(), vmCvar_t::integer, memoryPool, p, and POOLSIZE.

Referenced by BotAISetupClient(), G_NewString(), and G_ParseInfos().

00036                           {
00037     char    *p;
00038 
00039     if ( g_debugAlloc.integer ) {
00040         G_Printf( "G_Alloc of %i bytes (%i left)\n", size, POOLSIZE - allocPoint - ( ( size + 31 ) & ~31 ) );
00041     }
00042 
00043     if ( allocPoint + size > POOLSIZE ) {
00044       G_Error( "G_Alloc: failed on allocation of %i bytes\n", size ); // bk010103 - was %u, but is signed
00045         return NULL;
00046     }
00047 
00048     p = &memoryPool[allocPoint];
00049 
00050     allocPoint += ( size + 31 ) & ~31;
00051 
00052     return p;
00053 }

Here is the call graph for this function:

void G_InitMemory void   ) 
 

Definition at line 55 of file g_mem.c.

References allocPoint.

Referenced by G_InitGame().

00055                           {
00056     allocPoint = 0;
00057 }

void Svcmd_GameMem_f void   ) 
 

Definition at line 59 of file g_mem.c.

References allocPoint, G_Printf(), and POOLSIZE.

Referenced by ConsoleCommand().

00059                              {
00060     G_Printf( "Game memory status: %i out of %i bytes allocated\n", allocPoint, POOLSIZE );
00061 }

Here is the call graph for this function:


Variable Documentation

int allocPoint [static]
 

Definition at line 34 of file g_mem.c.

Referenced by G_Alloc(), G_InitMemory(), and Svcmd_GameMem_f().

char memoryPool[POOLSIZE] [static]
 

Definition at line 33 of file g_mem.c.

Referenced by G_Alloc().


Generated on Thu Aug 25 13:55:57 2005 for Quake III Arena by  doxygen 1.3.9.1