- Making your own malloc library for troubleshooting
- GLIBC hook for malloc
- Malloc tutorial
- A Malloc Tutorial by Marwan Burelle
Main issue is handling the recursive calls inside malloc. If you use printf in malloc that might cause issue as printf itself calls malloc for memory allocation resulting infinite recursion. On the other hand in some cases ld.so uses calloc internally. This alos result in infinite recursion.