Well, I would like to create my own improved malloc and free functions, and replace all the standard memory allocation functions.
This for several reasons :
- Be able to know how many memory is currently allocated to the application
- Log the allocations, including the addresses of allocations
- Keep a list of every address and size of each allocations
- And also to change, remove, renew the allocated space (for example to move the memory contents to another place)
I think I have already found an implementation of malloc(), and maybe I could find one for free() but how can I override the standard new and delete operators so as I can also control the memory they allocate or free ?