Christopher's post about x86 hardware memory protection (in the "Is
Linux really that secure?" thread) reminded me of something that C
programmers may find useful for tracking memory faults.  The first is
electric fence (http://perens.com/FreeSoftware/), which places the end
of each array at the end of a 4k memory page, and marks the next page as
a fault.  So if you overrun an array bounds it will segfault on the
exact instruction that overran the array.  You can also set it to test
underflows.  It uses a lot of memory though, and I've had problems with
in on large projects.
Valgrind, (http://valgrind.kde.org/) fully emulates an x86 CPU on your
CPU, but with things like array under/overflow checks.  It can also
profile cache hits, etc.  Very good, works with projects at least as
large as KDE, but a little slow.

Brad

Reply via email to