Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

当跨so引用时会出现误报 #9

Open
OreOooRanJie opened this issue Jul 17, 2024 · 3 comments
Open

当跨so引用时会出现误报 #9

OreOooRanJie opened this issue Jul 17, 2024 · 3 comments

Comments

@OreOooRanJie
Copy link

首先夸一波大佬,工具写的很棒

当我在工程中应用这个工具时,我发现存在较多的误报

简易代码:

`
void dummy() {
Init();
Deinit();
}

int main() {
dummy();
return 0;
}`

Init()函数中会初始化资源,其中包括进程级的全局资源
Deinit()函数会销毁掉资源
当我用asan工具进行内存检测时,是没有发现泄漏的(由于保密的关系,无法展示详细代码,sorry~~)

我想到的可能原因是工程依赖的xxx.so中存在全局资源,其定义在mallocvis之前,构造在运行时,也就是mallocvis之后,然后这个资源是通过类似于析构释放资源的,也就是在mallocvis之后释放,这就导致了资源的申请被监控到了,但是释放的过程没有被监控

我想咨询下这个问题有没有准确定位的办法,要是有解决方案就更好了(xxx.so必须依赖,且无法更改...)

@archibate
Copy link
Owner

archibate commented Jul 17, 2024 via email

@OreOooRanJie
Copy link
Author

OreOooRanJie commented Jul 17, 2024 via email

@archibate
Copy link
Owner

推送了,你看看,你可以定义以下这个宏:

#define MANUAL_GLOBAL_INIT 1

然后,就可以手动调用(见malloc_hook.cpp文件末尾)mallocvis_init和mallocvis_deinit了。

@archibate archibate reopened this Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants