Get the linux kernel, then you can browse through the source code and change it so that your version is used. How is it implemented? Well, for MS that is a secret, for linux you find a description here (for any other system: use google): http://www.ibm.com/developerworks/linux/library/l-memmod/
For more general (and easy-to-read) information on how mm works see A. Tanenbaum: "Modern Operating Systems", chapter 4.
Look in /usr/include/malloc.h for __malloc_hook and _free_hook (probably near
the bottom). These provide ways for you to define your own malloc and free functions
without having to change the library.
Well, I pretty much doubt that you will find any monolithic kernel in which the memory management is not done in the kernel. You can write *hook* functions in glibc. But the kernel won't tell you the areas of free memory without other system calls very much like malloc, which is, as I understand it, not what nate wants.
The hooks are only intended e.g. to trace the calls of malloc and free in order to find memory-leaks etc. and call malloc() themselves. For a usable malloc "from scratch" you would have to implement paging, segmentation etc. which is, as jsmith stated, far from trivial (the memory management subsystem from my linux version is 35639 lines of ugly C code, minus some lines of comments...)