HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SYS_Memory.h File Reference
#include "SYS_API.h"
#include "SYS_Align.h"
#include "SYS_AtomicInt.h"
#include "SYS_Types.h"
#include <cstddef>
+ Include dependency graph for SYS_Memory.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  SYS_MemoryUser
 
class  SYS_MemoryTable
 
class  SYS_Memory
 

Macros

#define SYS_MEMORY_SUBCLASS(STATIC, prefix, table)
 
#define SYS_MEMPRINTSIZE   32
 

Functions

SYS_API void SYSprintMemory (char buf[SYS_MEMPRINTSIZE], int64 memory, int field_width=-1)
 

Macro Definition Documentation

#define SYS_MEMORY_SUBCLASS (   STATIC,
  prefix,
  table 
)
Value:
STATIC void *prefix##Malloc(int i, size_t amount) \
{ return SYS_Memory::Malloc(table, i, amount); } \
STATIC void *prefix##Calloc(int i, size_t amount) \
{ return SYS_Memory::Calloc(table, i, amount); } \
STATIC void *prefix##Realloc(int i, void *m, size_t o, size_t n) \
{ return SYS_Memory::Realloc(table, i, m, o, n); } \
STATIC void prefix##Free(int i, void *m, size_t amount) \
{ SYS_Memory::Free(table, i, m, amount); } \
STATIC void prefix##acquire(int i, size_t amount) \
{ SYS_Memory::acquire(table, i, amount); } \
STATIC void prefix##release(int i, size_t amount) \
{ SYS_Memory::release(table, i, amount); } \
static inline SYS_MemoryTable &prefix##getTable() { return table; }
static void release(SYS_MemoryTable &table, int which_entry, size_t amount)
Track a memory free that wasn't performed by this class.
Definition: SYS_Memory.h:229
GLdouble n
Definition: glcorearb.h:2008
static void Free(SYS_MemoryTable &table, int which_entry, void *memory, size_t amount)
Definition: SYS_Memory.h:209
static void * Realloc(SYS_MemoryTable &table, int which_entry, void *original_memory, size_t old_amount, size_t new_amount)
Definition: SYS_Memory.h:169
static void * Calloc(SYS_MemoryTable &table, int which_entry, size_t amount)
Definition: SYS_Memory.h:153
GLenum GLenum GLsizei void * table
Definition: glad.h:5129
static void acquire(SYS_MemoryTable &table, int which_entry, size_t amount)
Track a memory acquisition that wasn't performed by this class.
Definition: SYS_Memory.h:222
static void * Malloc(SYS_MemoryTable &table, int which_entry, size_t amount)
Definition: SYS_Memory.h:139

When implementing in a different library, the following macro can be used to implement a localized interface. For example, we might have SYS_MEMORY_SUBCLASS(, GU, theGUMemoryTable) or class GU_Memory { public: SYS_MEMORY_SUBCLASS(static, GU, myMemoryTable) private: static SYS_MemoryTable myMemoryTable; };

Definition at line 248 of file SYS_Memory.h.

#define SYS_MEMPRINTSIZE   32

Convenience function to print memory in a consistent format (i.e. 12.3 KB). To print "18446744073709551616.00 MB" requires 27 characters. There are 5 extra characters for good measure in SYS_MEMPRINTSIZE

Definition at line 267 of file SYS_Memory.h.

Function Documentation

SYS_API void SYSprintMemory ( char  buf[SYS_MEMPRINTSIZE],
int64  memory,
int  field_width = -1 
)