mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-25 06:13:13 +00:00
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().
This commit is contained in:
34
src/valgrind.c
Normal file
34
src/valgrind.c
Normal file
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user