How do you create a new malloc() function defined in C language ?
I don’t even have an elflike hint as to how to do this , how to map virtual space address with physical space , what algorithm to follow ? I do know that malloc() is not so efficient as it can cause fragmentation. So something efficient can be created. Even if not efficient , how to implement a naive C malloc function?
It was asked recently in an interview.
I think it’s a nice example of malloc in An example in Chapter 8.7 of C Programming Language book: