Changeset View
Changeset View
Standalone View
Standalone View
src/track/heaptrack_preload.cpp
Context not available. | |||||
17 | */ | 17 | */ | ||
---|---|---|---|---|---|
18 | 18 | | |||
19 | #include "libheaptrack.h" | 19 | #include "libheaptrack.h" | ||
20 | #include "util/config.h" | ||||
20 | 21 | | |||
21 | #include <cstdio> | 22 | #include <cstdio> | ||
22 | #include <cstdlib> | 23 | #include <cstdlib> | ||
Context not available. | |||||
33 | #else | 34 | #else | ||
34 | # define HAVE_ALIGNED_ALLOC 0 | 35 | # define HAVE_ALIGNED_ALLOC 0 | ||
35 | #endif | 36 | #endif | ||
36 | #if defined(_BSD_SOURCE) || defined(_SVID_SOURCE) || defined(__USE_MISC) | | |||
37 | # define HAVE_CFREE 1 | | |||
38 | #else | | |||
39 | # define HAVE_CFREE 0 | | |||
40 | #endif | | |||
41 | 37 | | |||
42 | extern "C" { | 38 | extern "C" { | ||
43 | __attribute__((weak)) void __libc_freeres(); | 39 | __attribute__((weak)) void __libc_freeres(); | ||
Context not available. | |||||
86 | HOOK(malloc); | 82 | HOOK(malloc); | ||
87 | HOOK(free); | 83 | HOOK(free); | ||
88 | HOOK(calloc); | 84 | HOOK(calloc); | ||
89 | #if HAVE_CFREE | 85 | #if defined(HAVE_CFREE) | ||
90 | HOOK(cfree); | 86 | HOOK(cfree); | ||
91 | #endif | 87 | #endif | ||
92 | HOOK(realloc); | 88 | HOOK(realloc); | ||
Context not available. | |||||
147 | hooks::malloc.init(); | 143 | hooks::malloc.init(); | ||
148 | hooks::free.init(); | 144 | hooks::free.init(); | ||
149 | hooks::calloc.init(); | 145 | hooks::calloc.init(); | ||
150 | #if HAVE_CFREE | 146 | #if defined(HAVE_CFREE) | ||
151 | hooks::cfree.init(); | 147 | hooks::cfree.init(); | ||
152 | #endif | 148 | #endif | ||
153 | hooks::realloc.init(); | 149 | hooks::realloc.init(); | ||
Context not available. | |||||
225 | return ret; | 221 | return ret; | ||
226 | } | 222 | } | ||
227 | 223 | | |||
228 | #if HAVE_CFREE | 224 | #if defined(HAVE_CFREE) | ||
229 | void cfree(void* ptr) noexcept | 225 | void cfree(void* ptr) noexcept | ||
230 | { | 226 | { | ||
231 | if (!hooks::cfree) { | 227 | if (!hooks::cfree) { | ||
Context not available. |