summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2012-01-11 15:59:34 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2012-01-11 15:59:34 -0500
commit60a9c8d7abe102cefeb72666b9645a6dd34e84b8 (patch)
tree4d38a549788da66f3eba8795233c083562018152
parent32a9255d8ce7515be0fd8c566cb4085a03d99e2b (diff)
Fixes for alignment tests with tcmalloc
-rwxr-xr-xindra/llcommon/llmemory.h20
1 files changed, 7 insertions, 13 deletions
diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 1b54b56107..9dd776ff57 100755
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -27,7 +27,6 @@
#define LLMEMORY_H
#include "llmemtype.h"
-#if !LL_USE_TCMALLOC
inline void* ll_aligned_malloc( size_t size, int align )
{
void* mem = malloc( size + (align - 1) + sizeof(void*) );
@@ -43,6 +42,7 @@ inline void ll_aligned_free( void* ptr )
free( ((void**)ptr)[-1] );
}
+#if !LL_USE_TCMALLOC
inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
{
#if defined(LL_WINDOWS)
@@ -79,6 +79,12 @@ inline void ll_aligned_free_16(void *p)
free(p); // posix_memalign() is compatible with heap deallocator
#endif
}
+#else // USE_TCMALLOC
+// ll_aligned_foo_16 are not needed with tcmalloc
+#define ll_aligned_malloc_16 malloc
+#define ll_aligned_realloc_16 realloc
+#define ll_aligned_free_16 free
+#endif // USE_TCMALLOC
inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed with ll_aligned_free_32().
{
@@ -106,18 +112,6 @@ inline void ll_aligned_free_32(void *p)
#endif
}
-#else // USE_TCMALLOC
-// ll_aligned_foo are noops now that we use tcmalloc everywhere
-// (tcmalloc aligns automatically at appropriate intervals)
-#define ll_aligned_malloc( size, align ) malloc(size)
-#define ll_aligned_free( ptr ) free(ptr)
-#define ll_aligned_malloc_16 malloc
-#define ll_aligned_realloc_16 realloc
-#define ll_aligned_free_16 free
-#define ll_aligned_malloc_32 malloc
-#define ll_aligned_free_32 free
-#endif // LL_DEBUG
-
#ifndef __DEBUG_PRIVATE_MEM__
#define __DEBUG_PRIVATE_MEM__ 0
#endif