Implementation of the Toshi memory management system. More...
#include "ToshiPCH.h"
#include "TMemory.h"
#include "Thread/TMutex.h"
#include "Thread/TMutexLock.h"
#include "TMemoryDebugOff.h"
Go to the source code of this file.
Namespaces | |
namespace | Toshi |
Macros | |
#define | MEM_TO_NODE(PTR) |
#define | PP_CAT(A, B) |
#define | PP_EXPAND(...) |
#define | PP_VA_ARG_SIZE(...) |
#define | PP_ZERO_ARGS_DETECT(...) |
#define | PP_ZERO_ARGS_DETECT_PREFIX__ZERO_ARGS_DETECT_SUFFIX , , , , , , , , , , , 0 |
#define | PP_APPLY_ARG_N(ARGS) |
#define | PP_ARG_N(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, N, ...) |
#define | PP_RSEQ_N 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
#define | PP_OVERLOAD_SELECT(NAME, NUM) |
#define | PP_MACRO_OVERLOAD(NAME, ...) |
#define | CALL_THIS_4(ADDR, TYPE, RET_TYPE, THIS) |
#define | CALL_THIS_6(ADDR, TYPE, RET_TYPE, THIS, TYPE1, VALUE1) |
#define | CALL_THIS_8(ADDR, TYPE, RET_TYPE, THIS, TYPE1, VALUE1, TYPE2, VALUE2) |
#define | CALL_THIS_10(ADDR, TYPE, RET_TYPE, THIS, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3) |
#define | CALL_THIS_12(ADDR, TYPE, RET_TYPE, THIS, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3, TYPE4, VALUE4) |
#define | CALL_THIS_14(ADDR, TYPE, RET_TYPE, THIS, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3, TYPE4, VALUE4, TYPE5, VALUE5) |
#define | CALL_THIS(...) |
#define | CALL_2(ADDR, RET_TYPE) |
#define | CALL_4(ADDR, RET_TYPE, TYPE1, VALUE1) |
#define | CALL_6(ADDR, RET_TYPE, TYPE1, VALUE1, TYPE2, VALUE2) |
#define | CALL_8(ADDR, RET_TYPE, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3) |
#define | CALL_10(ADDR, RET_TYPE, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3, TYPE4, VALUE4) |
#define | CALL_12(ADDR, RET_TYPE, TYPE1, VALUE1, TYPE2, VALUE2, TYPE3, VALUE3, TYPE4, VALUE4, TYPE5, VALUE5) |
#define | CALL(...) |
Functions | |
void *__CRTDECL | operator new (TSIZE size) |
Global new operator implementation. | |
void *__CRTDECL | operator new (TSIZE size, ::std::nothrow_t const &) noexcept |
Global new operator with nothrow implementation. | |
void *__CRTDECL | operator new[] (TSIZE size) |
Global new[] operator implementation. | |
void *__CRTDECL | operator new[] (TSIZE size, ::std::nothrow_t const &) noexcept |
Global new[] operator with nothrow implementation. | |
void __CRTDECL | operator delete (void *ptr) noexcept |
Global delete operator implementation. | |
void __CRTDECL | operator delete (void *ptr, ::std::nothrow_t const &) noexcept |
Global delete operator with nothrow implementation. | |
void __CRTDECL | operator delete[] (void *ptr) noexcept |
Global delete[] operator implementation. | |
void __CRTDECL | operator delete[] (void *ptr, ::std::nothrow_t const &) noexcept |
Global delete[] operator with nothrow implementation. | |
void __CRTDECL | operator delete[] (void *ptr, TSIZE _Size) noexcept |
Global delete[] operator with size implementation. | |
void * | TMalloc (TSIZE a_uiSize, Toshi::TMemory::MemBlock *a_pMemBlock, const TCHAR *a_szFileName, TINT a_iLineNum) |
Allocates memory from a specific memory block. | |
void * | TMalloc (TSIZE a_uiSize, const TCHAR *a_szFileName, TINT a_iLineNum) |
Allocates memory with debug information. | |
void * | TMalloc (TSIZE a_uiSize) |
Allocates memory with default alignment. | |
void * | TMemalign (TSIZE a_uiAlignment, TSIZE a_uiSize, Toshi::TMemory::MemBlock *a_pMemBlock) |
Allocates aligned memory from a specific memory block. | |
void * | TMemalign (TSIZE a_uiSize, TSIZE a_uiAlignment) |
Allocates aligned memory. | |
void | TFree (void *a_pMem) |
Frees previously allocated memory. | |
Variables | |
TMemory * | Toshi::g_pMemory = nullptr |
Implementation of the Toshi memory management system.
This file implements the core memory management functionality including:
Definition in file TMemory.cpp.
#define CALL | ( | ... | ) |
Definition at line 194 of file TMemory.cpp.
#define CALL_10 | ( | ADDR, | |
RET_TYPE, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2, | |||
TYPE3, | |||
VALUE3, | |||
TYPE4, | |||
VALUE4 ) |
Definition at line 192 of file TMemory.cpp.
#define CALL_12 | ( | ADDR, | |
RET_TYPE, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2, | |||
TYPE3, | |||
VALUE3, | |||
TYPE4, | |||
VALUE4, | |||
TYPE5, | |||
VALUE5 ) |
Definition at line 193 of file TMemory.cpp.
#define CALL_2 | ( | ADDR, | |
RET_TYPE ) |
Definition at line 188 of file TMemory.cpp.
#define CALL_4 | ( | ADDR, | |
RET_TYPE, | |||
TYPE1, | |||
VALUE1 ) |
Definition at line 189 of file TMemory.cpp.
#define CALL_6 | ( | ADDR, | |
RET_TYPE, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2 ) |
Definition at line 190 of file TMemory.cpp.
#define CALL_8 | ( | ADDR, | |
RET_TYPE, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2, | |||
TYPE3, | |||
VALUE3 ) |
Definition at line 191 of file TMemory.cpp.
#define CALL_THIS | ( | ... | ) |
Definition at line 186 of file TMemory.cpp.
#define CALL_THIS_10 | ( | ADDR, | |
TYPE, | |||
RET_TYPE, | |||
THIS, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2, | |||
TYPE3, | |||
VALUE3 ) |
Definition at line 183 of file TMemory.cpp.
#define CALL_THIS_12 | ( | ADDR, | |
TYPE, | |||
RET_TYPE, | |||
THIS, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2, | |||
TYPE3, | |||
VALUE3, | |||
TYPE4, | |||
VALUE4 ) |
Definition at line 184 of file TMemory.cpp.
#define CALL_THIS_14 | ( | ADDR, | |
TYPE, | |||
RET_TYPE, | |||
THIS, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2, | |||
TYPE3, | |||
VALUE3, | |||
TYPE4, | |||
VALUE4, | |||
TYPE5, | |||
VALUE5 ) |
Definition at line 185 of file TMemory.cpp.
#define CALL_THIS_4 | ( | ADDR, | |
TYPE, | |||
RET_TYPE, | |||
THIS ) |
Definition at line 180 of file TMemory.cpp.
#define CALL_THIS_6 | ( | ADDR, | |
TYPE, | |||
RET_TYPE, | |||
THIS, | |||
TYPE1, | |||
VALUE1 ) |
Definition at line 181 of file TMemory.cpp.
#define CALL_THIS_8 | ( | ADDR, | |
TYPE, | |||
RET_TYPE, | |||
THIS, | |||
TYPE1, | |||
VALUE1, | |||
TYPE2, | |||
VALUE2 ) |
Definition at line 182 of file TMemory.cpp.
#define MEM_TO_NODE | ( | PTR | ) |
Definition at line 127 of file TMemory.cpp.
#define PP_APPLY_ARG_N | ( | ARGS | ) |
Definition at line 173 of file TMemory.cpp.
#define PP_ARG_N | ( | _0, | |
_1, | |||
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9, | |||
_10, | |||
_11, | |||
_12, | |||
_13, | |||
N, | |||
... ) |
Definition at line 174 of file TMemory.cpp.
#define PP_CAT | ( | A, | |
B ) |
Definition at line 164 of file TMemory.cpp.
#define PP_EXPAND | ( | ... | ) |
Definition at line 165 of file TMemory.cpp.
#define PP_MACRO_OVERLOAD | ( | NAME, | |
... ) |
Definition at line 178 of file TMemory.cpp.
#define PP_OVERLOAD_SELECT | ( | NAME, | |
NUM ) |
Definition at line 177 of file TMemory.cpp.
#define PP_RSEQ_N 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 |
Definition at line 175 of file TMemory.cpp.
#define PP_VA_ARG_SIZE | ( | ... | ) |
Definition at line 168 of file TMemory.cpp.
#define PP_ZERO_ARGS_DETECT | ( | ... | ) |
Definition at line 170 of file TMemory.cpp.
#define PP_ZERO_ARGS_DETECT_PREFIX__ZERO_ARGS_DETECT_SUFFIX , , , , , , , , , , , 0 |
Definition at line 171 of file TMemory.cpp.
|
noexcept |
Global delete operator implementation.
ptr | Pointer to memory to free |
Definition at line 83 of file TMemory.cpp.
|
noexcept |
Global delete operator with nothrow implementation.
ptr | Pointer to memory to free |
Definition at line 92 of file TMemory.cpp.
|
noexcept |
Global delete[] operator implementation.
ptr | Pointer to memory to free |
Definition at line 101 of file TMemory.cpp.
|
noexcept |
Global delete[] operator with nothrow implementation.
ptr | Pointer to memory to free |
Definition at line 110 of file TMemory.cpp.
|
noexcept |
Global delete[] operator with size implementation.
ptr | Pointer to memory to free |
_Size | Size of memory (unused) |
Definition at line 120 of file TMemory.cpp.
void *__CRTDECL operator new | ( | TSIZE | size | ) |
Global new operator implementation.
size | Size to allocate |
Definition at line 28 of file TMemory.cpp.
|
noexcept |
Global new operator with nothrow implementation.
size | Size to allocate |
Definition at line 42 of file TMemory.cpp.
void *__CRTDECL operator new[] | ( | TSIZE | size | ) |
Global new[] operator implementation.
size | Size to allocate |
Definition at line 56 of file TMemory.cpp.
|
noexcept |
Global new[] operator with nothrow implementation.
size | Size to allocate |
Definition at line 70 of file TMemory.cpp.
void TFree | ( | void * | a_pMem | ) |
Frees previously allocated memory.
a_pMem | Pointer to memory to free |
Definition at line 1054 of file TMemory.cpp.
void * TMalloc | ( | TSIZE | a_uiSize | ) |
Allocates memory with default alignment.
a_uiSize | Size of memory to allocate |
Definition at line 1005 of file TMemory.cpp.
Allocates memory with debug information.
a_uiSize | Size of memory to allocate |
a_szFileName | Source file name |
a_iLineNum | Source line number |
Definition at line 990 of file TMemory.cpp.
void * TMalloc | ( | TSIZE | a_uiSize, |
Toshi::TMemory::MemBlock * | a_pMemBlock, | ||
const TCHAR * | a_szFileName = TNULL, | ||
TINT | a_iLineNum = -1 ) |
Allocates memory from a specific memory block.
a_uiSize | Size of memory to allocate |
a_pMemBlock | Memory block to allocate from |
a_szFileName | Source file name (optional) |
a_iLineNum | Source line number (optional) |
Definition at line 973 of file TMemory.cpp.
Allocates aligned memory from a specific memory block.
a_uiAlignment | Alignment requirement |
a_uiSize | Size of memory to allocate |
a_pMemBlock | Memory block to allocate from |
Definition at line 1020 of file TMemory.cpp.
Allocates aligned memory.
a_uiSize | Size of memory to allocate |
a_uiAlignment | Alignment requirement |
Definition at line 1038 of file TMemory.cpp.