diff options
author | Jason Evans <je@fb.com> | 2014-04-15 23:35:08 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2014-04-15 23:49:57 (GMT) |
commit | bd87b01999416ec7418ff8bdb504d9b6c009ff68 (patch) | |
tree | 776e813f41743767750516e7f10317ac8ba92df0 /src/valgrind.c | |
parent | ecd3e59ca351d7111ec72a327fe0c009f2aa69a0 (diff) | |
download | jemalloc-bd87b01999416ec7418ff8bdb504d9b6c009ff68.zip jemalloc-bd87b01999416ec7418ff8bdb504d9b6c009ff68.tar.gz jemalloc-bd87b01999416ec7418ff8bdb504d9b6c009ff68.tar.bz2 |
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/valgrind.c')
-rw-r--r-- | src/valgrind.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/valgrind.c b/src/valgrind.c new file mode 100644 index 0000000..8e7ef3a --- /dev/null +++ b/src/valgrind.c @@ -0,0 +1,34 @@ +#include "jemalloc/internal/jemalloc_internal.h" +#ifndef JEMALLOC_VALGRIND +# error "This source file is for Valgrind integration." +#endif + +#include <valgrind/memcheck.h> + +void +valgrind_make_mem_noaccess(void *ptr, size_t usize) +{ + + VALGRIND_MAKE_MEM_NOACCESS(ptr, usize); +} + +void +valgrind_make_mem_undefined(void *ptr, size_t usize) +{ + + VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize); +} + +void +valgrind_make_mem_defined(void *ptr, size_t usize) +{ + + VALGRIND_MAKE_MEM_DEFINED(ptr, usize); +} + +void +valgrind_freelike_block(void *ptr, size_t usize) +{ + + VALGRIND_FREELIKE_BLOCK(ptr, usize); +} |