44 #include "as_config.h" 48 extern asALLOCFUNC_t userAlloc;
49 extern asFREEFUNC_t userFree;
51 #ifdef WIP_16BYTE_ALIGN 56 typedef void *(*asALLOCALIGNEDFUNC_t)(size_t, size_t);
57 typedef void (*asFREEALIGNEDFUNC_t)(
void *);
58 extern asALLOCALIGNEDFUNC_t userAllocAligned;
59 extern asFREEALIGNEDFUNC_t userFreeAligned;
60 typedef void *(*asALLOCALIGNEDFUNCDEBUG_t)(size_t, size_t,
const char *,
unsigned int);
63 const int MAX_TYPE_ALIGNMENT = 16;
66 bool isAligned(
const void *
const pointer, asUINT alignment);
68 #endif // WIP_16BYTE_ALIGN 74 #define asNEW(x) new(userAlloc(sizeof(x))) x 75 #define asDELETE(ptr,x) {void *tmp = ptr; (ptr)->~x(); userFree(tmp);} 77 #define asNEWARRAY(x,cnt) (x*)userAlloc(sizeof(x)*cnt) 78 #define asDELETEARRAY(ptr) userFree(ptr) 80 #ifdef WIP_16BYTE_ALIGN 81 #define asNEWARRAYALIGNED(x,cnt, alignment) (x*)userAllocAligned(sizeof(x)*cnt, alignment) 82 #define asDELETEARRAYALIGNED(ptr) userFreeAligned(ptr) 87 typedef void *(*asALLOCFUNCDEBUG_t)(size_t,
const char *,
unsigned int);
89 #define asNEW(x) new(((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(x), __FILE__, __LINE__)) x 90 #define asDELETE(ptr,x) {void *tmp = ptr; (ptr)->~x(); userFree(tmp);} 92 #define asNEWARRAY(x,cnt) (x*)((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(x)*cnt, __FILE__, __LINE__) 93 #define asDELETEARRAY(ptr) userFree(ptr) 95 #ifdef WIP_16BYTE_ALIGN 97 #define asNEWARRAYALIGNED(x,cnt, alignment) (x*)userAllocAligned(sizeof(x)*cnt, alignment) 98 #define asDELETEARRAYALIGNED(ptr) userFreeAligned(ptr) 106 #include "as_criticalsection.h" 107 #include "as_array.h" 116 void FreeUnusedMemory();
118 void *AllocScriptNode();
119 void FreeScriptNode(
void *ptr);
121 #ifndef AS_NO_COMPILER 122 void *AllocByteInstruction();
123 void FreeByteInstruction(
void *ptr);
127 DECLARECRITICALSECTION(cs)
Definition: as_memory.h:111
Definition: as_array.h:47