I am amazed that I can't find any document stating the difference between _int_malloc
and malloc
in the output of Valgrind's callgrind
tool.
Could anybody explain what's their difference?
Furthermore, I actually write C++ code, so I am using exclusively new
not malloc
, but in the callgrind output only mallocs are showing up.
The malloc
listed in the callgrind
output will be the implementation of malloc
provided by the glibc function __libc_malloc
in the file glibc/malloc/malloc.c.
This function calls another function, intended for internal use only, named _int_malloc
, which does most of the hard work.
As writing standard libraries is very difficult, the authors must be very good programmers and therefore very lazy. So, instead of writing memory allocation code twice, the new
operator calls malloc
in order to get the memory it requires.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With