for a code main.c:
#include <stdio.h>
#include <stdlib.h>
int main()
{
void* p = malloc(1000);
free(p);
return(0);
}
1st compile: gcc main.c -o a.out
2nd compile: gcc main.c -ltcmalloc -o a.out
1st use glibc stdlib,2nd use tcmalloc
and I can write main.c like this:
#include <stdio.h>
#include <google/tcmalloc.h>
int main()
{
void* p = tc_malloc(1000);
tc_free(p);
return(0);
}
3rd compile: gcc main.c -ltcmalloc -o a.out
3rd is surely use tcmalloc
Is the 2nd and 3rd compile the same ?
I know tcmalloc support more functions like tc_malloc_size
/ tc_valloc
, I guess use tc_* functions is better option to write main.c, so I have more functions ?
I can't find any man page for functions like tc_valloc / tc_new / tc_newarray / tc_valloc / tc_pvalloc
http://sourcecodebrowser.com/google-perftools/1.4/windows_2google_2tcmalloc_8h.html
i find this man page about all tcmalloc functions