0

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?

sharptooth
  • 167,383
  • 100
  • 513
  • 979
teZeriusz
  • 81
  • 2
  • 8
  • 1
    Why not dbx? You can use dbx, the Sun Studio debugger, run-time checking (RTC) feature. (dbx) check-leaks (dbx) run args. – Abhay Sep 02 '09 at 08:44
  • because we need to find leak in dll, and don't have framework with debug symbols. Anyway I'm not sure that even if we had it, dbx can handle it? – teZeriusz Oct 13 '09 at 20:12

4 Answers4

4

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
  • 1,404
  • 1
  • 14
  • 19
2

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
  • 91
  • 1
  • 2
  • 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 Oct 13 '09 at 20:25
  • 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 Oct 16 '09 at 07:48
1

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

David Allan Finch
  • 1,414
  • 8
  • 20
1

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
  • 114,398
  • 98
  • 311
  • 431