1 //===-- wrappers_c_bionic.cc ------------------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 // This is only used when compiled as part of Bionic.
12 #if SCUDO_ANDROID && _BIONIC
14 #include "allocator_config.h"
15 #include "wrappers_c.h"
16 #include "wrappers_c_checks.h"
21 static scudo::Allocator<scudo::AndroidConfig> Allocator;
22 static scudo::Allocator<scudo::AndroidSvelteConfig> SvelteAllocator;
26 // Regular MallocDispatch definitions.
27 #define SCUDO_PREFIX(name) CONCATENATE(scudo_, name)
28 #define SCUDO_ALLOCATOR Allocator
29 #include "wrappers_c.inc"
30 #undef SCUDO_ALLOCATOR
33 // Svelte MallocDispatch definitions.
34 #define SCUDO_PREFIX(name) CONCATENATE(scudo_svelte_, name)
35 #define SCUDO_ALLOCATOR SvelteAllocator
36 #include "wrappers_c.inc"
37 #undef SCUDO_ALLOCATOR
40 // The following is the only function that will end up initializing both
41 // allocators, which will result in a slight increase in memory footprint.
42 INTERFACE void __scudo_print_stats(void) {
43 Allocator.printStats();
44 SvelteAllocator.printStats();
49 #endif // SCUDO_ANDROID && _BIONIC