Blender V5.3
BLI_memarena.cc File Reference

Efficient memory allocation for many small chunks. More...

#include <cstdlib>
#include <cstring>
#include "MEM_guardedalloc.h"
#include "BLI_asan.hh"
#include "BLI_memarena.hh"
#include "BLI_utildefines.hh"
#include "BLI_strict_flags.hh"

Go to the source code of this file.

Classes

struct  blender::MemBuf
struct  blender::MemArena

Namespaces

namespace  blender
 BMesh Iterators.

Macros

#define VALGRIND_CREATE_MEMPOOL(pool, rzB, is_zeroed)
#define VALGRIND_DESTROY_MEMPOOL(pool)
#define VALGRIND_MEMPOOL_ALLOC(pool, addr, size)
#define VALGRIND_MOVE_MEMPOOL(pool_a, pool_b)
#define PADUP(num, amt)

Functions

static void blender::memarena_buf_free_all (MemBuf *mb)
MemArena * blender::BLI_memarena_new (size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(2) ATTR_MALLOC
void blender::BLI_memarena_use_calloc (MemArena *ma) ATTR_NONNULL(1)
void blender::BLI_memarena_use_malloc (MemArena *ma) ATTR_NONNULL(1)
void blender::BLI_memarena_use_align (MemArena *ma, size_t align) ATTR_NONNULL(1)
void blender::BLI_memarena_free (MemArena *ma) ATTR_NONNULL(1)
static void blender::memarena_curbuf_align (MemArena *ma)
void * blender::BLI_memarena_alloc (MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void * blender::BLI_memarena_calloc (MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
void blender::BLI_memarena_merge (MemArena *ma_dst, MemArena *ma_src)
void blender::BLI_memarena_clear (MemArena *ma) ATTR_NONNULL(1)

Detailed Description

Efficient memory allocation for many small chunks.

Memory Arena

Memory arena's are commonly used when the program needs to quickly allocate lots of little bits of data, which are all freed at the same moment.

Note
Memory can't be freed during the arenas lifetime.

Definition in file BLI_memarena.cc.

Macro Definition Documentation

◆ PADUP

#define PADUP ( num,
amt )
Value:
(((num) + ((amt) - 1)) & ~((amt) - 1))

Pad num up by amt (must be power of two).

Definition at line 113 of file BLI_memarena.cc.

Referenced by blender::BLI_memarena_alloc(), and blender::memarena_curbuf_align().

◆ VALGRIND_CREATE_MEMPOOL

#define VALGRIND_CREATE_MEMPOOL ( pool,
rzB,
is_zeroed )

◆ VALGRIND_DESTROY_MEMPOOL

#define VALGRIND_DESTROY_MEMPOOL ( pool)

◆ VALGRIND_MEMPOOL_ALLOC

#define VALGRIND_MEMPOOL_ALLOC ( pool,
addr,
size )
Value:
UNUSED_VARS(pool, addr, size)

Definition at line 31 of file BLI_memarena.cc.

Referenced by blender::BLI_memarena_alloc(), blender::BLI_mempool_alloc(), and blender::BLI_mempool_free().

◆ VALGRIND_MOVE_MEMPOOL

#define VALGRIND_MOVE_MEMPOOL ( pool_a,
pool_b )
Value:
UNUSED_VARS(pool_a, pool_b)

Definition at line 32 of file BLI_memarena.cc.

Referenced by blender::BLI_memarena_merge().