I'm glad that you liked my post!
I actually used the Perl hash algorithm in a C project once. So I got pretty far into how Perl did it.
I wrote a .h file, memtracker.h for a local college. Students just included this .h file in
their C or C++ program and magic happened. Without any source mods or link dependencies, this
thing tracked C or C++ memory allocations and deallocations and when the user program exited, it showed whether
there were any memory leaks and a table showing how all of this played out. It would say things like
"on line X, that memory allocation has no corresponding deallocation", etc. Anyway I used a hash as the main
data structure to keep track of things. Turned out to be a more complicated project that I had first
thought - mainly due to making it work with 2 compilers each of C and C++ using the same single .h file.
Final file was somewhat north of 1,500 lines of C with a lot of C pre-processor voo-doo. Anyway turned
out to be a fun project. One C++ prof had his own version of this, but it was so slow, it was adding
20 minutes execution time to a large C++ lab! My version was so fast that it wasn't even user perceptible
and it had more features. Using a very efficient data structure was a big part of the speed improvement.