Comment on Libvirt: Adoption of GLib library to replace GNULIB and home grown codeparentComments−stretchcat5yIsn't the right way of doing this to use a different implementation of malloc, rather than wrapping malloc with your own meta-malloc?−inetknght5yIsn't the right way of doing this to use a different implementation of malloc, rather than wrapping malloc with your own meta-malloc?Yup [0].There's even other complete libraries like tcmalloc [1] and jemalloc [2].[0] https://stackoverflow.com/a/262481/1111557[1] https://github.com/google/tcmalloc[2] https://github.com/jemalloc/jemalloc−saagarjha5yOne reason I can think of wrapping malloc is that C is more likely to give you that than whatever OS-specific API you are going to use to get memory from the kernel (if you even have one!).
Comments
Isn't the right way of doing this to use a different implementation of malloc, rather than wrapping malloc with your own meta-malloc?
Yup [0].
There's even other complete libraries like tcmalloc [1] and jemalloc [2].
[0] https://stackoverflow.com/a/262481/1111557
[1] https://github.com/google/tcmalloc
[2] https://github.com/jemalloc/jemalloc
One reason I can think of wrapping malloc is that C is more likely to give you that than whatever OS-specific API you are going to use to get memory from the kernel (if you even have one!).