tags:

views:

292

answers:

4

Hi, 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?

+1  A: 

I think there are freeware libs but we use Purify on Solaris which works well.

David Allan Finch
+3  A: 

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.

yoco
SunOS _is_ UNIX, probably the second-most popular variant after Mac OSX
MSalters
I heard that Purify is great tool, unfortunately license is assigned to other divisions.
teZeriusz
+1  A: 

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.

Ben Summers
I did not realize that dtrace can be use to find memleaks. I thought of it as something similar to codecoverage tool but a little lowlevel, and in run time. BTW is there real no overload during dtracing process? We are playing with protocols and time is important to us.
teZeriusz
DTrace has almost no overhead when it's disabled, but it does have a performance impact when enabled. However, since a design goal is to diagnose problems on production systems, it's pretty minimal. Best advice is to try it and see, ideally on a dev install.
Ben Summers
+1  A: 

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.

Thomas Owens