C++ SunOS 上的应用程序存在内存泄漏。如何找到它?
我刚刚登陆 SunOS:
$ uname -a
SunOS sunfi95 5.9 Generic_122300-13 sun4u sparc SUNW,Sun-Fire-880
并拥有 Sun studio:
$ CC -V
CC: Sun C++ 5.8 2005/10/13
如何在代码中找到 memleaks? (在这种情况下,dbx 不是一个选项)。 Valgrind 不适用于 sparc 系统,我想到的唯一解决方案是使用一些智能库,该库将重载 new 和 delete 并计算它们被调用的次数。 有人知道 BSD 上有类似许可证的东西吗?
i just landed on SunOS:
$ uname -a
SunOS sunfi95 5.9 Generic_122300-13 sun4u sparc SUNW,Sun-Fire-880
and have Sun studio:
$ CC -V
CC: Sun C++ 5.8 2005/10/13
How I can find memleaks in code? (dbx is not a option in this case).
Valgrind does not work on sparc systems, only one solution that cross my mind is to use some smart lib that will overload new and delete and count how many times they are called.
Anyone know something that is on BSD like license?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在 Sun OS 上,您可以使用 Purify,或者尝试移植(通常您也会将泄漏移植到 Unix/Linux 上,并使用 valgrind 来查找泄漏。
On Sun OS you can use Purify, or try to port(generally you'll port the leak, too) your program to Unix/Linux and use valgrind to find the leak.
DTrace 对于了解 Solaris 应用程序中发生的情况非常有用。
以下是如何在 Sun 中使用它的示例。
DTrace can be very useful for working out what's going on in Solaris applications.
Here's an example of how to use it from Sun.
我认为有免费软件库,但我们在 Solaris 上使用 Purify,效果很好。
I think there are freeware libs but we use Purify on Solaris which works well.
您还可以使用名为 cppcheck 的应用程序来查找内存泄漏,以及许多其他问题。它是一个免费/开源产品。
我从未在 SunOS 或 Sparc 机器上使用过它,但源代码是可用的,您可以尝试构建它。我不确定幕后发生了什么,但我不明白为什么不能在 SunOS Sparc 机器上构建它。
You can also use an application called cppcheck to find memory leaks, as well as a number of other problems. It's a free/open source product.
I've never used it on SunOS or Sparc machines, but the source is available and you could try to build it. I'm not sure what goes on under the hood, but I don't see why you couldn't build it on a SunOS Sparc machine.