Blender  V2.93
BLI_memarena.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
24 #pragma once
25 
26 #include "BLI_compiler_attrs.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 /* A reasonable standard buffer size, big
33  * enough to not cause much internal fragmentation,
34  * small enough not to waste resources
35  */
36 #define BLI_MEMARENA_STD_BUFSIZE MEM_SIZE_OPTIMAL(1 << 14)
37 
38 struct MemArena;
39 typedef struct MemArena MemArena;
40 
41 struct MemArena *BLI_memarena_new(const size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT
43 void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1);
46 void BLI_memarena_use_align(struct MemArena *ma, const size_t align) ATTR_NONNULL(1);
51 
53 
54 #ifdef __cplusplus
55 }
56 #endif
#define ATTR_MALLOC
#define ATTR_ALLOC_SIZE(...)
#define ATTR_NONNULL(...)
void BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() int BLI_kdtree_nd_() ATTR_WARN_UNUSED_RESULT
void BLI_memarena_use_align(struct MemArena *ma, const size_t align) ATTR_NONNULL(1)
Definition: BLI_memarena.c:101
void BLI_memarena_free(struct MemArena *ma) ATTR_NONNULL(1)
Definition: BLI_memarena.c:109
void BLI_memarena_use_malloc(struct MemArena *ma) ATTR_NONNULL(1)
Definition: BLI_memarena.c:96
void BLI_memarena_use_calloc(struct MemArena *ma) ATTR_NONNULL(1)
Definition: BLI_memarena.c:91
void * BLI_memarena_alloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
Definition: BLI_memarena.c:131
void BLI_memarena_clear(MemArena *ma) ATTR_NONNULL(1)
Definition: BLI_memarena.c:185
struct MemArena * BLI_memarena_new(const size_t bufsize, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2) ATTR_MALLOC
Definition: BLI_memarena.c:79
void * BLI_memarena_calloc(struct MemArena *ma, size_t size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_ALLOC_SIZE(2)
Definition: BLI_memarena.c:168
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
const char * name
Definition: BLI_memarena.c:57
size_t align
Definition: BLI_memarena.c:61
size_t bufsize
Definition: BLI_memarena.c:60