blob: 6837e393de512038f1a6f9d9ad250ea716165514 [file] [log] [blame]
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -08001/*
2 * Copyright (C) 2009 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29/*
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -080030 * Contains definition of structures, global variables, and implementation of
31 * routines that are used by malloc leak detection code and other components in
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080032 * the system. The trick is that some components expect these data and
33 * routines to be defined / implemented in libc.so library, regardless
34 * whether or not MALLOC_LEAK_CHECK macro is defined. To make things even
35 * more tricky, malloc leak detection code, implemented in
36 * libc_malloc_debug.so also requires access to these variables and routines
37 * (to fill allocation entry hash table, for example). So, all relevant
38 * variables and routines are defined / implemented here and exported
39 * to all, leak detection code and other components via dynamic (libc.so),
40 * or static (libc.a) linking.
41 */
42
43#include <stdlib.h>
44#include <pthread.h>
45#include <unistd.h>
46#include "dlmalloc.h"
47#include "malloc_debug_common.h"
48
49/*
50 * In a VM process, this is set to 1 after fork()ing out of zygote.
51 */
52int gMallocLeakZygoteChild = 0;
53
54pthread_mutex_t gAllocationsMutex = PTHREAD_MUTEX_INITIALIZER;
55HashTable gHashTable;
56
57// =============================================================================
58// output functions
59// =============================================================================
60
61static int hash_entry_compare(const void* arg1, const void* arg2)
62{
Christopher Tate52e7d3d2010-08-09 13:43:46 -070063 int result;
64
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080065 HashEntry* e1 = *(HashEntry**)arg1;
66 HashEntry* e2 = *(HashEntry**)arg2;
67
Christopher Tate52e7d3d2010-08-09 13:43:46 -070068 // if one or both arg pointers are null, deal gracefully
69 if (e1 == NULL) {
70 result = (e2 == NULL) ? 0 : 1;
71 } else if (e2 == NULL) {
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080072 result = -1;
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080073 } else {
Christopher Tate52e7d3d2010-08-09 13:43:46 -070074 size_t nbAlloc1 = e1->allocations;
75 size_t nbAlloc2 = e2->allocations;
76 size_t size1 = e1->size & ~SIZE_FLAG_MASK;
77 size_t size2 = e2->size & ~SIZE_FLAG_MASK;
78 size_t alloc1 = nbAlloc1 * size1;
79 size_t alloc2 = nbAlloc2 * size2;
80
81 // sort in descending order by:
82 // 1) total size
83 // 2) number of allocations
84 //
85 // This is used for sorting, not determination of equality, so we don't
86 // need to compare the bit flags.
Christopher Tate52e7d3d2010-08-09 13:43:46 -070087 if (alloc1 > alloc2) {
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080088 result = -1;
Christopher Tate52e7d3d2010-08-09 13:43:46 -070089 } else if (alloc1 < alloc2) {
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080090 result = 1;
91 } else {
Christopher Tate52e7d3d2010-08-09 13:43:46 -070092 if (nbAlloc1 > nbAlloc2) {
93 result = -1;
94 } else if (nbAlloc1 < nbAlloc2) {
95 result = 1;
96 } else {
97 result = 0;
98 }
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -080099 }
100 }
101 return result;
102}
103
104/*
105 * Retrieve native heap information.
106 *
107 * "*info" is set to a buffer we allocate
108 * "*overallSize" is set to the size of the "info" buffer
109 * "*infoSize" is set to the size of a single entry
110 * "*totalMemory" is set to the sum of all allocations we're tracking; does
111 * not include heap overhead
112 * "*backtraceSize" is set to the maximum number of entries in the back trace
113 */
114void get_malloc_leak_info(uint8_t** info, size_t* overallSize,
115 size_t* infoSize, size_t* totalMemory, size_t* backtraceSize)
116{
117 // don't do anything if we have invalid arguments
118 if (info == NULL || overallSize == NULL || infoSize == NULL ||
119 totalMemory == NULL || backtraceSize == NULL) {
120 return;
121 }
tedbo9d8be542010-10-05 13:06:06 -0700122 *totalMemory = 0;
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800123
124 pthread_mutex_lock(&gAllocationsMutex);
125
126 if (gHashTable.count == 0) {
127 *info = NULL;
128 *overallSize = 0;
129 *infoSize = 0;
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800130 *backtraceSize = 0;
131 goto done;
132 }
133
134 void** list = (void**)dlmalloc(sizeof(void*) * gHashTable.count);
135
136 // get the entries into an array to be sorted
137 int index = 0;
138 int i;
139 for (i = 0 ; i < HASHTABLE_SIZE ; i++) {
140 HashEntry* entry = gHashTable.slots[i];
141 while (entry != NULL) {
142 list[index] = entry;
143 *totalMemory = *totalMemory +
144 ((entry->size & ~SIZE_FLAG_MASK) * entry->allocations);
145 index++;
146 entry = entry->next;
147 }
148 }
149
150 // XXX: the protocol doesn't allow variable size for the stack trace (yet)
151 *infoSize = (sizeof(size_t) * 2) + (sizeof(intptr_t) * BACKTRACE_SIZE);
152 *overallSize = *infoSize * gHashTable.count;
153 *backtraceSize = BACKTRACE_SIZE;
154
155 // now get A byte array big enough for this
156 *info = (uint8_t*)dlmalloc(*overallSize);
157
158 if (*info == NULL) {
159 *overallSize = 0;
The Android Open Source Project95faece2010-04-08 11:11:53 -0700160 goto out_nomem_info;
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800161 }
162
163 qsort((void*)list, gHashTable.count, sizeof(void*), hash_entry_compare);
164
165 uint8_t* head = *info;
166 const int count = gHashTable.count;
167 for (i = 0 ; i < count ; i++) {
168 HashEntry* entry = list[i];
169 size_t entrySize = (sizeof(size_t) * 2) + (sizeof(intptr_t) * entry->numEntries);
170 if (entrySize < *infoSize) {
171 /* we're writing less than a full entry, clear out the rest */
The Android Open Source Project95faece2010-04-08 11:11:53 -0700172 memset(head + entrySize, 0, *infoSize - entrySize);
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800173 } else {
174 /* make sure the amount we're copying doesn't exceed the limit */
175 entrySize = *infoSize;
176 }
177 memcpy(head, &(entry->size), entrySize);
178 head += *infoSize;
179 }
180
The Android Open Source Project95faece2010-04-08 11:11:53 -0700181out_nomem_info:
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800182 dlfree(list);
183
184done:
185 pthread_mutex_unlock(&gAllocationsMutex);
186}
187
188void free_malloc_leak_info(uint8_t* info)
189{
190 dlfree(info);
191}
192
193struct mallinfo mallinfo()
194{
195 return dlmallinfo();
196}
197
198void* valloc(size_t bytes) {
199 /* assume page size of 4096 bytes */
200 return memalign( getpagesize(), bytes );
201}
202
203/* Support for malloc debugging.
204 * Note that if USE_DL_PREFIX is not defined, it's assumed that memory
205 * allocation routines are implemented somewhere else, so all our custom
206 * malloc routines should not be compiled at all.
207 */
208#ifdef USE_DL_PREFIX
209
210/* Table for dispatching malloc calls, initialized with default dispatchers. */
211const MallocDebug __libc_malloc_default_dispatch __attribute__((aligned(32))) =
212{
213 dlmalloc, dlfree, dlcalloc, dlrealloc, dlmemalign
214};
215
216/* Selector of dispatch table to use for dispatching malloc calls. */
217const MallocDebug* __libc_malloc_dispatch = &__libc_malloc_default_dispatch;
218
219void* malloc(size_t bytes) {
220 return __libc_malloc_dispatch->malloc(bytes);
221}
222void free(void* mem) {
223 __libc_malloc_dispatch->free(mem);
224}
225void* calloc(size_t n_elements, size_t elem_size) {
226 return __libc_malloc_dispatch->calloc(n_elements, elem_size);
227}
228void* realloc(void* oldMem, size_t bytes) {
229 return __libc_malloc_dispatch->realloc(oldMem, bytes);
230}
231void* memalign(size_t alignment, size_t bytes) {
232 return __libc_malloc_dispatch->memalign(alignment, bytes);
233}
234
235/* We implement malloc debugging only in libc.so, so code bellow
236 * must be excluded if we compile this file for static libc.a
237 */
238#ifndef LIBC_STATIC
239#include <sys/system_properties.h>
240#include <dlfcn.h>
241#include "logd.h"
242
243// =============================================================================
244// log functions
245// =============================================================================
246
247#define debug_log(format, ...) \
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800248 __libc_android_log_print(ANDROID_LOG_DEBUG, "libc", (format), ##__VA_ARGS__ )
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800249#define error_log(format, ...) \
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800250 __libc_android_log_print(ANDROID_LOG_ERROR, "libc", (format), ##__VA_ARGS__ )
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800251#define info_log(format, ...) \
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800252 __libc_android_log_print(ANDROID_LOG_INFO, "libc", (format), ##__VA_ARGS__ )
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800253
254/* Table for dispatching malloc calls, depending on environment. */
255static MallocDebug gMallocUse __attribute__((aligned(32))) = {
256 dlmalloc, dlfree, dlcalloc, dlrealloc, dlmemalign
257};
258
259extern char* __progname;
260
261/* Handle to shared library where actual memory allocation is implemented.
262 * This library is loaded and memory allocation calls are redirected there
263 * when libc.debug.malloc environment variable contains value other than
264 * zero:
265 * 1 - For memory leak detections.
266 * 5 - For filling allocated / freed memory with patterns defined by
267 * CHK_SENTINEL_VALUE, and CHK_FILL_FREE macros.
268 * 10 - For adding pre-, and post- allocation stubs in order to detect
269 * buffer overruns.
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800270 * Note that emulator's memory allocation instrumentation is not controlled by
271 * libc.debug.malloc value, but rather by emulator, started with -memcheck
272 * option. Note also, that if emulator has started with -memcheck option,
273 * emulator's instrumented memory allocation will take over value saved in
274 * libc.debug.malloc. In other words, if emulator has started with -memcheck
275 * option, libc.debug.malloc value is ignored.
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800276 * Actual functionality for debug levels 1-10 is implemented in
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800277 * libc_malloc_debug_leak.so, while functionality for emultor's instrumented
278 * allocations is implemented in libc_malloc_debug_qemu.so and can be run inside
279 * the emulator only.
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800280 */
281static void* libc_malloc_impl_handle = NULL;
282
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800283/* Make sure we have MALLOC_ALIGNMENT that matches the one that is
284 * used in dlmalloc. Emulator's memchecker needs this value to properly
285 * align its guarding zones.
286 */
287#ifndef MALLOC_ALIGNMENT
288#define MALLOC_ALIGNMENT ((size_t)8U)
289#endif /* MALLOC_ALIGNMENT */
290
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800291/* Initializes memory allocation framework once per process. */
292static void malloc_init_impl(void)
293{
294 const char* so_name = NULL;
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800295 MallocDebugInit malloc_debug_initialize = NULL;
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800296 unsigned int qemu_running = 0;
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800297 unsigned int debug_level = 0;
298 unsigned int memcheck_enabled = 0;
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800299 char env[PROP_VALUE_MAX];
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800300 char memcheck_tracing[PROP_VALUE_MAX];
Iliyan Malchev7d2e24e2012-05-29 16:46:17 -0700301 char debug_program[PROP_VALUE_MAX];
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800302
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800303 /* Get custom malloc debug level. Note that emulator started with
304 * memory checking option will have priority over debug level set in
305 * libc.debug.malloc system property. */
306 if (__system_property_get("ro.kernel.qemu", env) && atoi(env)) {
307 qemu_running = 1;
308 if (__system_property_get("ro.kernel.memcheck", memcheck_tracing)) {
309 if (memcheck_tracing[0] != '0') {
310 // Emulator has started with memory tracing enabled. Enforce it.
311 debug_level = 20;
312 memcheck_enabled = 1;
313 }
314 }
315 }
316
317 /* If debug level has not been set by memcheck option in the emulator,
318 * lets grab it from libc.debug.malloc system property. */
319 if (!debug_level && __system_property_get("libc.debug.malloc", env)) {
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800320 debug_level = atoi(env);
321 }
322
323 /* Debug level 0 means that we should use dlxxx allocation
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800324 * routines (default). */
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800325 if (!debug_level) {
326 return;
327 }
328
Iliyan Malchev7d2e24e2012-05-29 16:46:17 -0700329 /* If libc.debug.malloc.program is set and is not a substring of progname,
330 * then exit.
331 */
332 if (__system_property_get("libc.debug.malloc.program", debug_program)) {
333 if (!strstr(__progname, debug_program)) {
334 return;
335 }
336 }
337
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800338 // Lets see which .so must be loaded for the requested debug level
339 switch (debug_level) {
340 case 1:
341 case 5:
342 case 10:
343 so_name = "/system/lib/libc_malloc_debug_leak.so";
344 break;
345 case 20:
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800346 // Quick check: debug level 20 can only be handled in emulator.
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800347 if (!qemu_running) {
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800348 error_log("%s: Debug level %d can only be set in emulator\n",
349 __progname, debug_level);
350 return;
351 }
352 // Make sure that memory checking has been enabled in emulator.
353 if (!memcheck_enabled) {
354 error_log("%s: Memory checking is not enabled in the emulator\n",
355 __progname);
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800356 return;
357 }
358 so_name = "/system/lib/libc_malloc_debug_qemu.so";
359 break;
360 default:
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800361 error_log("%s: Debug level %d is unknown\n",
362 __progname, debug_level);
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800363 return;
364 }
365
366 // Load .so that implements the required malloc debugging functionality.
367 libc_malloc_impl_handle = dlopen(so_name, RTLD_LAZY);
368 if (libc_malloc_impl_handle == NULL) {
369 error_log("%s: Missing module %s required for malloc debug level %d\n",
370 __progname, so_name, debug_level);
371 return;
372 }
373
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800374 // Initialize malloc debugging in the loaded module.
375 malloc_debug_initialize =
376 dlsym(libc_malloc_impl_handle, "malloc_debug_initialize");
377 if (malloc_debug_initialize == NULL) {
378 error_log("%s: Initialization routine is not found in %s\n",
379 __progname, so_name);
380 dlclose(libc_malloc_impl_handle);
381 return;
382 }
383 if (malloc_debug_initialize()) {
384 dlclose(libc_malloc_impl_handle);
385 return;
386 }
387
388 if (debug_level == 20) {
389 // For memory checker we need to do extra initialization.
390 int (*memcheck_initialize)(int, const char*) =
391 dlsym(libc_malloc_impl_handle, "memcheck_initialize");
392 if (memcheck_initialize == NULL) {
393 error_log("%s: memcheck_initialize routine is not found in %s\n",
394 __progname, so_name);
395 dlclose(libc_malloc_impl_handle);
396 return;
397 }
398 if (memcheck_initialize(MALLOC_ALIGNMENT, memcheck_tracing)) {
399 dlclose(libc_malloc_impl_handle);
400 return;
401 }
402 }
403
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800404 // Initialize malloc dispatch table with appropriate routines.
405 switch (debug_level) {
406 case 1:
407 __libc_android_log_print(ANDROID_LOG_INFO, "libc",
408 "%s using MALLOC_DEBUG = %d (leak checker)\n",
409 __progname, debug_level);
410 gMallocUse.malloc =
411 dlsym(libc_malloc_impl_handle, "leak_malloc");
412 gMallocUse.free =
413 dlsym(libc_malloc_impl_handle, "leak_free");
414 gMallocUse.calloc =
415 dlsym(libc_malloc_impl_handle, "leak_calloc");
416 gMallocUse.realloc =
417 dlsym(libc_malloc_impl_handle, "leak_realloc");
418 gMallocUse.memalign =
419 dlsym(libc_malloc_impl_handle, "leak_memalign");
420 break;
421 case 5:
422 __libc_android_log_print(ANDROID_LOG_INFO, "libc",
423 "%s using MALLOC_DEBUG = %d (fill)\n",
424 __progname, debug_level);
425 gMallocUse.malloc =
426 dlsym(libc_malloc_impl_handle, "fill_malloc");
427 gMallocUse.free =
428 dlsym(libc_malloc_impl_handle, "fill_free");
429 gMallocUse.calloc = dlcalloc;
430 gMallocUse.realloc =
431 dlsym(libc_malloc_impl_handle, "fill_realloc");
432 gMallocUse.memalign =
433 dlsym(libc_malloc_impl_handle, "fill_memalign");
434 break;
435 case 10:
436 __libc_android_log_print(ANDROID_LOG_INFO, "libc",
437 "%s using MALLOC_DEBUG = %d (sentinels, fill)\n",
438 __progname, debug_level);
439 gMallocUse.malloc =
440 dlsym(libc_malloc_impl_handle, "chk_malloc");
441 gMallocUse.free =
442 dlsym(libc_malloc_impl_handle, "chk_free");
443 gMallocUse.calloc =
444 dlsym(libc_malloc_impl_handle, "chk_calloc");
445 gMallocUse.realloc =
446 dlsym(libc_malloc_impl_handle, "chk_realloc");
447 gMallocUse.memalign =
448 dlsym(libc_malloc_impl_handle, "chk_memalign");
449 break;
450 case 20:
451 __libc_android_log_print(ANDROID_LOG_INFO, "libc",
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800452 "%s[%u] using MALLOC_DEBUG = %d (instrumented for emulator)\n",
453 __progname, getpid(), debug_level);
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800454 gMallocUse.malloc =
455 dlsym(libc_malloc_impl_handle, "qemu_instrumented_malloc");
456 gMallocUse.free =
457 dlsym(libc_malloc_impl_handle, "qemu_instrumented_free");
458 gMallocUse.calloc =
459 dlsym(libc_malloc_impl_handle, "qemu_instrumented_calloc");
460 gMallocUse.realloc =
461 dlsym(libc_malloc_impl_handle, "qemu_instrumented_realloc");
462 gMallocUse.memalign =
463 dlsym(libc_malloc_impl_handle, "qemu_instrumented_memalign");
464 break;
465 default:
466 break;
467 }
468
469 // Make sure dispatch table is initialized
470 if ((gMallocUse.malloc == NULL) ||
471 (gMallocUse.free == NULL) ||
472 (gMallocUse.calloc == NULL) ||
473 (gMallocUse.realloc == NULL) ||
474 (gMallocUse.memalign == NULL)) {
475 error_log("%s: Cannot initialize malloc dispatch table for debug level"
476 " %d: %p, %p, %p, %p, %p\n",
477 __progname, debug_level,
478 gMallocUse.malloc, gMallocUse.free,
479 gMallocUse.calloc, gMallocUse.realloc,
480 gMallocUse.memalign);
481 dlclose(libc_malloc_impl_handle);
482 libc_malloc_impl_handle = NULL;
483 } else {
484 __libc_malloc_dispatch = &gMallocUse;
485 }
486}
487
488static pthread_once_t malloc_init_once_ctl = PTHREAD_ONCE_INIT;
489
490#endif // !LIBC_STATIC
491#endif // USE_DL_PREFIX
492
493/* Initializes memory allocation framework.
494 * This routine is called from __libc_init routines implemented
495 * in libc_init_static.c and libc_init_dynamic.c files.
496 */
497void malloc_debug_init(void)
498{
Vladimir Chtchetkine75fba682010-02-12 08:59:58 -0800499 /* We need to initialize malloc iff we implement here custom
500 * malloc routines (i.e. USE_DL_PREFIX is defined) for libc.so */
Vladimir Chtchetkineb74ceb22009-11-17 14:13:38 -0800501#if defined(USE_DL_PREFIX) && !defined(LIBC_STATIC)
502 if (pthread_once(&malloc_init_once_ctl, malloc_init_impl)) {
503 error_log("Unable to initialize malloc_debug component.");
504 }
505#endif // USE_DL_PREFIX && !LIBC_STATIC
506}