3 ms·
Valgrind Works with OS X nowadays. Plus, Xcode has the benefit of Clang's Static Analysis being built right in. You really can't beat checking one box and havi
by Zev 17y ago
Valgrind
Works with OS X nowadays. Plus, Xcode has the benefit of Clang's Static Analysis being built right in. You really can't beat checking one box and having it automatically scan over your code when you build to point out a lot of mistakes (like leaks or logic that's never hit). True, different purposes. But, you can install Valgrind. And in the meantime, Clang will catch some things for you, before you have to find them with Valgrind.
// edit: Whoops, I was wrong: Valgrind doesn't work on Snow Leopard yet, like I initially thought.
Apt-get
If you're targeting another Mac system, do you really want to ship your own version of Tck/Tk? Do you really want to use a custom library for your own development and another for shipping? Or do you want to use the one the system provides? Hint: The latter allows for much smaller downloads. Lets the user start using your software much quicker.
API stability
Theres applications out there that work on PPC and 32/64bit Intel, on any OS from Jaguar on. 7 year old applications that still work perfectly fine, across OS's that have had major changes, seems to be pretty stable API-wise to me. Not to mention, there are API's that have been deprecated since 10.3, but can still be used (even though you really shouldn't use them) in 10.6.
/proc filesystem
See the `sysctl` command instead. Bonus: You can access all this information with a sysctl() call in code too!
Compiler
Given Xcode ships with gprof, I'd be highly surprised if it doesn't actually work. And theres always Shark, that can be run without having to add special profiling flags when compiling. Or Instruments (ie: DTrace).
As for -arch i386 not working? Thats just not true.
bash:~ Zach$ gcc -arch i386 foo.c -o foo
bash:~ Zach$ file foo
foo: Mach-O executable i386
- makecheck 17y agoOr do you want to use the one the system provides? Hint: The latter allows for much smaller downloads. Lets the user start using your software much quicker. This is certainly what I try to do, as well. However, it is not for the faint of heart. For instance, I had to be extremely creative in order for my app to use the system Python, and yet work correctly (it was bound to C++) on Mac OS X 10.3.9 through 10.6.
- Zev 17y agoGiven PyObjC didn't start shipping with OS X until 10.4, I would agree that you would have to be creative to make it work.
- makecheck 17y agoI used SWIG to build the bridges, and compiled multiple interfaces; the right one is chosen at launch time. 10.3.9 was especially interesting because it doesn't support universal binaries either. :)
- antirez 17y agoHello. Valgrind for Snow Leopard was broken and in the latest weeks got a patch that's just an initial support. Don't know if things improved in the last week or so, but last time checked it was not ready for prime time. About -arch i386, sorry my English is poor, what I mean is, gprof is not working even with binaries compiled with -arch i386. Edit: forgot to mention that there are things in Mac OS X that are missing on Linux and I like a lot. For instance dtrace and leaks. Leaks is really cool since it can check memory leaks at run-time with a standard executable, and works very well.
- Zev 17y agoAbout -arch i386, sorry my English is poor, what I mean is, gprof is not working even with binaries compiled with -arch i386. Thats still wrong: 247:~ Zach$ gcc -pg -arch i386 foo.c -o foo 247:~ Zach$ file foo foo: Mach-O executable i386 247:~ Zach$ ./foo hello 247:~ Zach$ gprof foo call graph profile: The sum of self and descendents is the major sort for this listing. function entries: [rest of the output snipped, I can pastebin if you want.] Though, you should really look at Shark (`man shark`, or Developer/Applications/Performance Tools/Shark.app), as an alternative to gprof. However, you are right about Valgrind not working on Snow Leopard yet. I had thought it was working by now. Whoops, on my part. I edited my first post.
- antirez 17y agoYep with -arch i386 it appears to work but the profiling info it returns is all zeroed. There are the functions but mostly 0% everything. Don't know what's the problem. With 64 bit target it's worse than this (some error printed on screen at startup). Thanks for the hint about Shark, I'm playing with it and it seems cool indeed.
- yosh 17y ago> Yep with -arch i386 it appears to work but the profiling info it returns is all zeroed. That's the story of OS X since from when it was first released. For example, you'd have some functionality advertised as being in the system libraries (like, oh, certain important pthread functions) so they'd pass the configure checks, but they would be in reality just stub functions that mean nothing. So your program would subtly fail. That particular problem was fixed in 10.1, but it seems like every release has a few things like that: something from UNIX that looks like it's there, but actually amounts to no-ops. It's maddening.