12#define MEMORY_ANNOTATION_COMMA_PARAM , const_char_pointer pszAnnotation
13#define MEMORY_ANNOTATION_COMMA_PARAM_DEF MEMORY_ANNOTATION_COMMA_PARAM = nullptr
14#define MEMORY_ANNOTATION_COMMA_ARG , pszAllocation
18#define MEMORY_ANNOTATION_COMMA_PARAM
19#define MEMORY_ANNOTATION_COMMA_PARAM_DEF
20#define MEMORY_ANNOTATION_COMMA_ARG
28#define HEAP_PADDING_SIZE 8
35 ::heap::enum_memory m_ememory;
39 const_char_pointer m_pszAnnotation;
41 const_char_pointer m_pszMemoryAnnotationPadding;
51#if HEAP_PADDING_SIZE > 0
53 ::u8 m_padding[HEAP_PADDING_SIZE];
63inline static struct heap_memory * heap_memory_get(
void * pmemory)
71inline static memsize heap_memory_aligned_provision_get_size(memsize size, ::i32 iAlignByteCount)
74 return size +
sizeof(
struct heap_memory) + HEAP_PADDING_SIZE + iAlignByteCount - 1;
79inline static memsize heap_memory_unaligned_provision_get_size(memsize size)
82 return size +
sizeof(
struct heap_memory) + HEAP_PADDING_SIZE;
87inline static void * heap_memory_unaligned(
void * p, memsize size, ::i32 blockuse, ::heap::enum_memory ememory MEMORY_ANNOTATION_COMMA_PARAM_DEF)
90 void * pmemory = (
void *)((iptr)p +
sizeof(
struct heap_memory));
92 struct heap_memory * pheap = heap_memory_get(pmemory);
94 pheap->m_back = (::i32)(((iptr)pmemory) - ((iptr)p));
96 pheap->m_blockuse = blockuse;
100 pheap->m_size = (::u32) size;
102 pheap->m_ememory = ememory;
109inline static void * heap_memory_aligned(
void * p, memsize size, ::i32 blockuse, ::i32 iAlignByteCount, ::heap::enum_memory ememory MEMORY_ANNOTATION_COMMA_PARAM_DEF)
112 void * pmemory = (
void *)((((iptr)p) +
sizeof(
struct heap_memory) + iAlignByteCount - 1) & ((~((iptr)iAlignByteCount - 1))));
114 struct heap_memory * pheap = heap_memory_get(pmemory);
116 pheap->m_back = (::i32)(((iptr)pmemory) - ((iptr)p));
118 pheap->m_blockuse = blockuse;
120 pheap->m_align = iAlignByteCount;
122 pheap->m_size = (::u32) size;
124 pheap->m_ememory = ememory;
128 pheap->m_pszAnnotation = pszAnnotation;
137inline static void * heap_memory_base_get(
void * pmemory)
140 return (
void *)(((iptr)pmemory) - heap_memory_get(pmemory)->m_back);
145inline static ::i32 heap_memory_get_block_use(
void * pmemory)
148 return heap_memory_get(pmemory)->m_blockuse;
153inline static ::u8 heap_memory_get_align(
void * pmemory)
156 return heap_memory_get(pmemory)->m_align;
161inline static memsize heap_memory_get_size(
void * pmemory)
164 return heap_memory_get(pmemory)->m_size;
169void heap_memory_check_padding_after(
struct heap_memory* pheapmemory);
172typedef void * MEMORY_ALLOC(memsize s);
174typedef MEMORY_ALLOC * PFN_MEMORY_ALLOC;
178typedef void * MEMORY_REALLOC(
void * p, memsize s);
180typedef MEMORY_REALLOC * PFN_MEMORY_REALLOC;
184typedef void MEMORY_FREE(
void * p);
186typedef MEMORY_FREE * PFN_MEMORY_FREE;
190typedef memsize MEMORY_SIZE(
void *);
192typedef MEMORY_SIZE * PFN_MEMORY_SIZE;
Definition allocation.h:49