43 void *
allocate(
size_t size,
size_t alignment,
const char *name)
51 if (alignment > MEM_MIN_CPP_ALIGNMENT) {
53 void *ptr = this->
allocate(size, alignment, name);
75 void *
allocate(
size_t size,
size_t alignment,
const char *name)
81 if (std::max(alignment, Alignment) > MEM_MIN_CPP_ALIGNMENT) {
83 void *ptr = this->
allocate(size, alignment, name);
108 void *
allocate(
size_t size,
size_t alignment,
const char * )
111 void *ptr = malloc(size + alignment +
sizeof(MemHead));
112 void *used_ptr =
reinterpret_cast<void *
>(
116 (
static_cast<MemHead *
>(used_ptr) - 1)->offset = offset;
121 void *ptr = this->
allocate(size, alignment, name);
122 memset(ptr, 0, size);
128 MemHead *head =
static_cast<MemHead *
>(ptr) - 1;
129 int offset = -head->offset;
131 free(actual_pointer);
Read Blender memory allocation and freeing.
#define POINTER_OFFSET(v, ofs)
void deallocate(void *ptr)
void * allocate_zero(size_t size, size_t alignment, const char *name)
static constexpr size_t min_alignment
void * allocate(size_t size, size_t alignment, const char *name)
void * allocate(size_t size, size_t alignment, const char *name)
void deallocate(void *ptr)
void * allocate_zero(size_t size, size_t alignment, const char *name)
void * allocate_zero(size_t size, size_t alignment, const char *name)
void deallocate(void *ptr)
void * allocate(size_t size, size_t alignment, const char *)
void free(Subdiv *subdiv)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void MEM_delete_void(void *vmemh)
void * MEM_new_uninitialized_aligned(size_t len, size_t alignment, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(3)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
constexpr int64_t is_power_of_2(const int64_t x)
_W64 unsigned int uintptr_t