Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-10-10 22:18:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-10-10 22:18:13 +0400
commite220d3228f48d4cb3256b398b45b40bf6892e550 (patch)
tree39f9bdca2ee2e37bc7f17827006a00d7bfbb8a06 /intern/guardedalloc
parent8fd52b34330354f5a8d285fd0888ffe7e72895b1 (diff)
add MEM_SIZE_OPTIMAL to avoid memory fragmentation & waste lost to slop-space.
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index a2a446eb0a8..4fb68965338 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -173,6 +173,10 @@ extern "C" {
#define MEM_SAFE_FREE(v) if (v) { MEM_freeN(v); v = NULL; } (void)0
+/* overhead for lockfree allocator (use to avoid slop-space) */
+#define MEM_SIZE_OVERHEAD sizeof(size_t)
+#define MEM_SIZE_OPTIMAL(size) ((size) - MEM_SIZE_OVERHEAD)
+
#ifndef NDEBUG
extern const char *(*MEM_name_ptr)(void *vmemh);
#endif