Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
wwmemlog.cpp File Reference
#include "always.h"
#include "wwmemlog.h"
#include "wwdebug.h"
#include "vector.h"
#include "fastallocator.h"
#include <windows.h>

Go to the source code of this file.

Classes

class  MemoryCounterClass
 
class  ActiveCategoryStackClass
 
class  ActiveCategoryClass
 
class  MemLogClass
 
class  MemLogMutexLockClass
 
struct  MemoryLogStruct
 

Macros

#define USE_FAST_ALLOCATOR
 
#define DISABLE_MEMLOG   1
 
#define ALLOC_MEMORY(n)
 
#define FREE_MEMORY(p)
 
#define MEMLOG_USE_MUTEX   0
 
#define MEMLOG_USE_CRITICALSECTION   1
 
#define MEMLOG_USE_FASTCRITICALSECTION   0
 

Functions

WWINLINE void * Get_Mem_Log_Mutex (void)
 
WWINLINE void Lock_Mem_Log_Mutex (void)
 
WWINLINE void Unlock_Mem_Log_Mutex (void)
 

Variables

const int MAX_CATEGORY_STACK_DEPTH = 1024
 
const int MAX_CATEGORY_STACKS = 256
 
const int WWMEMLOG_KEY0 = (unsigned('G')<<24) | (unsigned('g')<<16) | (unsigned('0')<<8) | unsigned('l')
 
const int WWMEMLOG_KEY1 = (unsigned('~')<<24) | (unsigned('_')<<16) | (unsigned('d')<<8) | unsigned('3')
 

Macro Definition Documentation

◆ ALLOC_MEMORY

#define ALLOC_MEMORY ( n)
Value:
static FastAllocatorGeneral * Get_Allocator()
void * Alloc(unsigned int n)

Definition at line 61 of file wwmemlog.cpp.

◆ DISABLE_MEMLOG

#define DISABLE_MEMLOG   1

Definition at line 56 of file wwmemlog.cpp.

◆ FREE_MEMORY

#define FREE_MEMORY ( p)
Value:

Definition at line 62 of file wwmemlog.cpp.

◆ MEMLOG_USE_CRITICALSECTION

#define MEMLOG_USE_CRITICALSECTION   1

Definition at line 75 of file wwmemlog.cpp.

◆ MEMLOG_USE_FASTCRITICALSECTION

#define MEMLOG_USE_FASTCRITICALSECTION   0

Definition at line 76 of file wwmemlog.cpp.

◆ MEMLOG_USE_MUTEX

#define MEMLOG_USE_MUTEX   0

Definition at line 74 of file wwmemlog.cpp.

◆ USE_FAST_ALLOCATOR

#define USE_FAST_ALLOCATOR

Definition at line 48 of file wwmemlog.cpp.

Function Documentation

◆ Get_Mem_Log_Mutex()

WWINLINE void * Get_Mem_Log_Mutex ( void )

Definition at line 271 of file wwmemlog.cpp.

◆ Lock_Mem_Log_Mutex()

WWINLINE void Lock_Mem_Log_Mutex ( void )

Definition at line 294 of file wwmemlog.cpp.

◆ Unlock_Mem_Log_Mutex()

WWINLINE void Unlock_Mem_Log_Mutex ( void )

Definition at line 337 of file wwmemlog.cpp.

Variable Documentation

◆ MAX_CATEGORY_STACK_DEPTH

const int MAX_CATEGORY_STACK_DEPTH = 1024

ActiveCategoryStackClass This object is used to keep track of the "active memory category". Whenever memory is allocated it will be charged to the current active memory category. To be thread-safe, there will be one ActiveCategoryStack per thread that is encountered in the program.

Definition at line 153 of file wwmemlog.cpp.

◆ MAX_CATEGORY_STACKS

const int MAX_CATEGORY_STACKS = 256

ActiveCategoryClass This is a dynamic vector of ActiveCategoryStackClasses which adds a new stack each time a new thread is encountered. It also is able to return to you the active category for the currently active thread automatically.

Definition at line 194 of file wwmemlog.cpp.

◆ WWMEMLOG_KEY0

const int WWMEMLOG_KEY0 = (unsigned('G')<<24) | (unsigned('g')<<16) | (unsigned('0')<<8) | unsigned('l')

Definition at line 596 of file wwmemlog.cpp.

◆ WWMEMLOG_KEY1

const int WWMEMLOG_KEY1 = (unsigned('~')<<24) | (unsigned('_')<<16) | (unsigned('d')<<8) | unsigned('3')

Definition at line 597 of file wwmemlog.cpp.