diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-10-10 22:18:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-10-10 22:18:13 +0400 |
commit | e220d3228f48d4cb3256b398b45b40bf6892e550 (patch) | |
tree | 39f9bdca2ee2e37bc7f17827006a00d7bfbb8a06 /intern/guardedalloc/MEM_guardedalloc.h | |
parent | 8fd52b34330354f5a8d285fd0888ffe7e72895b1 (diff) |
add MEM_SIZE_OPTIMAL to avoid memory fragmentation & waste lost to slop-space.
Diffstat (limited to 'intern/guardedalloc/MEM_guardedalloc.h')
-rw-r--r-- | intern/guardedalloc/MEM_guardedalloc.h | 4 |
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 |