MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_debug_malloc_init

Function acl_debug_malloc_init

lib_acl/src/stdlib/debug/acl_debug_malloc.c:247–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245#endif
246
247ACL_DEBUG_MEM *acl_debug_malloc_init(ACL_DEBUG_MEM *debug_mem_ptr, const char *dump_file)
248{
249 ACL_DEBUG_MEM *mem;
250 if (debug_mem_ptr != NULL) {
251 __debug_mem = mem = debug_mem_ptr;
252 } else {
253 ASSERT(dump_file && *dump_file);
254
255 mem = (ACL_DEBUG_MEM*) calloc(1, sizeof(ACL_DEBUG_MEM));
256 acl_assert(mem);
257 __debug_mem = mem;
258 __debug_mem->dump_fp = fopen(dump_file, "wb+");
259 ASSERT(__debug_mem->dump_fp);
260 __debug_mem->table = debug_htable_create(1000);
261 ASSERT(__debug_mem->table);
262 acl_pthread_mutex_init(&__debug_mem->lock, NULL);
263#ifndef HAVE_NO_ATEXIT
264 atexit(debug_dump_atexit);
265#endif
266 fprintf(__debug_mem->dump_fp, "begin set mem_hook\n");
267 fflush(__debug_mem->dump_fp);
268 }
269
270 acl_mem_hook(acl_debug_malloc,
271 acl_debug_calloc,
272 acl_debug_realloc,
273 acl_debug_strdup,
274 acl_debug_strndup,
275 acl_debug_memdup,
276 acl_debug_free);
277
278 return mem;
279}

Callers 7

mainFunction · 0.85
mainFunction · 0.85
http_plugin_debug_memoryFunction · 0.85
http_plugin_debug_memoryFunction · 0.85
http_plugin_initFunction · 0.85
module_service_initFunction · 0.85
service_initFunction · 0.85

Calls 4

callocFunction · 0.85
debug_htable_createFunction · 0.85
acl_pthread_mutex_initFunction · 0.85
acl_mem_hookFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…