提交 850da0d8 编写于 作者: L lutao

Improve memtrace performance

issue:#I7GYZ1
Test:libc-test
Signed-off-by: Nlutao <lutao31@huawei.com>
上级 1b7349ad
......@@ -7,9 +7,19 @@
void memtrace(void* addr, size_t size, const char* tag, bool is_using)
{
#ifdef HOOK_ENABLE
volatile const struct MallocDispatchType* dispatch_table = get_current_dispatch_table();
volatile const struct MallocDispatchType* dispatch_table = (struct MallocDispatchType *)atomic_load_explicit(
&__musl_libc_globals.current_dispatch_table, memory_order_acquire);
if (__predict_false(dispatch_table != NULL)) {
dispatch_table->memtrace(addr, size, tag, is_using);
if (__get_memleak_hook_flag()) {
return;
}
if (!__get_global_hook_flag()) {
return;
}
else if (!__get_hook_flag()) {
return;
}
return dispatch_table->memtrace(addr, size, tag, is_using);
}
#endif
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册