Solaris LIBUMEM:获取“libmapmalloc.so.1 未找到” C应用程序何时执行SUBPROCESS?
我有一个在 Linux、Solaris 和 AIX 上运行的 C 应用程序。我使用 Totalview 的 MemoryScape 等工具来追踪 Linux 上的内存泄漏,它是 100% 干净的。然而,我注意到 Solaris 上有一个小漏洞。
所以我一直在 Solaris 上使用“libumem”来尝试查找泄漏。
我的应用程序要么调用“用户退出”(通过子进程调用),要么不调用。
因此,如果我在没有用户退出的情况下运行应用程序(因此没有子进程调用),那么 libumem 可以 100% 工作......而且我仍然没有看到泄漏......
LD_PRELOAD=libumem.so UMEM_DEBUG=audit ./myapplication config。但是
当我打开用户退出调用以便主应用程序调用子进程时,子进程在运行时将以下内容打印到 STDOUT:
ld.so.1: userexit_proxy: fatal: libmapmalloc.so.1: 没有这样的文件或目录
注意,如果我不使用“libumem”,那么应用程序运行 100 %...(仍然只是一个微小的内存泄漏)
现在我的应用程序是在 64 位中编译的,我注意到 /usr/lib/libmapmalloc.so.1 是 32 位,但这应该没有什么区别......
任何想法我如何可以在也调用子进程的应用程序上使用 libumem 吗?
注意:我也尝试将变量导出到整个环境,但仍然没有运气
export LD_PRELOAD=libumem.so export UMEM_DEBUG=audit
另外,如果我错了,请纠正我,但如果子进程完成,那么该子进程中的任何“泄漏内存”都会自动释放,对吗?所以我可以假设 Solaris 上的泄漏不是来自子进程调用吗?
在这方面的任何帮助将不胜感激
帮助
感谢林顿的
I have a C application that runs on Linux, Solaris, and AIX. I have used tools like Totalview's MemoryScape to track down memory leaks on Linux and it is 100% clean. However, I have noticed a small leak on Solaris.
So I have been using "libumem" on Solaris to try find the leaks.
My application either calls a "user exit" (via subprocess call) or doesn't.
So if I run the application with no user exits (therefore NO subprocess call) then libumem works 100%....and I see no leaks still...
LD_PRELOAD=libumem.so UMEM_DEBUG=audit ./myapplication config.ini
But when I turn on user exits call so that the main application calls subprocesses, then I get the following printed to STDOUT by the subprocess during runtime:
ld.so.1: userexit_proxy: fatal: libmapmalloc.so.1: No such file or directory
NOTE that if I do not use "libumem" then the application runs 100%...(just a tiny memory leak still)
Now my application is compiled in 64bit, and I notice that the /usr/lib/libmapmalloc.so.1 is 32 bit but that should not make a difference....
Any idea how I can use libumem on an application that also calls subprocesses?
NOTE: I have also tried to EXPORT the variables to the whole environment, still no luck
export LD_PRELOAD=libumem.so
export UMEM_DEBUG=audit
Also, please correct me if I am wrong but if a subprocess completes then any "leaked memory" in that subprocess would be freed automatically right? So I can assume no leaks on Solaris are coming from the subprocess call?
Any help in this regard will be greatly appreciated
Thanks for the help
Lynton
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当使用 dlerror 的代码错误地假定它返回非空值而 dlopen 成功时,已经观察到此行为(请参阅此邮件:印第安纳讨论。)我将首先跟踪您的应用程序以查看这些函数是否被调用以及如何调用。
/usr/lib/libmapmalloc.so.1 确实是 32 位,但如果您的应用程序是 64 位,它会使用 /usr/lib/amd64/libmapmalloc.so 或类似的内容。
您的说法是正确的,当(子)进程结束时,其所有内存分配都会被释放。
This behavior has already been observed when code using dlerror wrongly assumes it to return a non null value while dlopen succeed (see this mail: indiana discuss.) I would start by tracing your application to see if these functions are called and how.
/usr/lib/libmapmalloc.so.1 is indeed32 bit but if your application is 64 bit, it uses something like /usr/lib/amd64/libmapmalloc.so or similar.
You are correct stating that when a (sub) process ends, all of its memory allocation is freed.