On Linux, FreeBSD and other systems I have valgrind for checking for memory errors like invalid reads and similar. I really love valgrind. Now I have to test code on Solaris
The dbx included with the Sun Studio compilers includes memory access checking support in its "Run Time Checking" feature (the check
subcommand). See:
The related "Sun Memory Error Discovery Tool" is also available from http://cooltools.sunsource.net/discover/