aboutsummaryrefslogtreecommitdiffstats
path: root/src/base.c
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2014-04-15 16:35:08 -0700
committerJason Evans <je@fb.com>2014-04-15 16:49:57 -0700
commitbd87b01999416ec7418ff8bdb504d9b6c009ff68 (patch)
tree776e813f41743767750516e7f10317ac8ba92df0 /src/base.c
parentecd3e59ca351d7111ec72a327fe0c009f2aa69a0 (diff)
downloadplatform_external_jemalloc_new-bd87b01999416ec7418ff8bdb504d9b6c009ff68.tar.gz
platform_external_jemalloc_new-bd87b01999416ec7418ff8bdb504d9b6c009ff68.tar.bz2
platform_external_jemalloc_new-bd87b01999416ec7418ff8bdb504d9b6c009ff68.zip
Optimize Valgrind integration.
Forcefully disable tcache if running inside Valgrind, and remove Valgrind calls in tcache-specific code. Restructure Valgrind-related code to move most Valgrind calls out of the fast path functions. Take advantage of static knowledge to elide some branches in JEMALLOC_VALGRIND_REALLOC().
Diffstat (limited to 'src/base.c')
-rw-r--r--src/base.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/base.c b/src/base.c
index 4e62e8fa..03dcf8f4 100644
--- a/src/base.c
+++ b/src/base.c
@@ -63,7 +63,7 @@ base_alloc(size_t size)
ret = base_next_addr;
base_next_addr = (void *)((uintptr_t)base_next_addr + csize);
malloc_mutex_unlock(&base_mtx);
- VALGRIND_MAKE_MEM_UNDEFINED(ret, csize);
+ JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, csize);
return (ret);
}
@@ -89,7 +89,8 @@ base_node_alloc(void)
ret = base_nodes;
base_nodes = *(extent_node_t **)ret;
malloc_mutex_unlock(&base_mtx);
- VALGRIND_MAKE_MEM_UNDEFINED(ret, sizeof(extent_node_t));
+ JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret,
+ sizeof(extent_node_t));
} else {
malloc_mutex_unlock(&base_mtx);
ret = (extent_node_t *)base_alloc(sizeof(extent_node_t));
@@ -102,7 +103,7 @@ void
base_node_dealloc(extent_node_t *node)
{
- VALGRIND_MAKE_MEM_UNDEFINED(node, sizeof(extent_node_t));
+ JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(node, sizeof(extent_node_t));
malloc_mutex_lock(&base_mtx);
*(extent_node_t **)node = base_nodes;
base_nodes = node;