-
-
Save mmgaggle/a5818d4e8528d3681534 to your computer and use it in GitHub Desktop.
Tcmalloc Testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kyle@synapse ~/src/malloc_test $ > ./runtime_malloc | |
Tcmalloc default thread cache size:33554432 | |
Tcmalloc runtime thread cache size:134217728 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdlib> | |
#ifdef HAVE_GPERFTOOLS_HEAP_PROFILER_H | |
#include <gperftools/heap-profiler.h> | |
#else | |
#include <google/heap-profiler.h> | |
#endif | |
#ifdef HAVE_GPERFTOOLS_MALLOC_EXTENSION_H | |
#include <gperftools/malloc_extension.h> | |
#else | |
#include <google/malloc_extension.h> | |
#endif | |
using namespace std; | |
int main () | |
{ | |
size_t tc_cache_sz; | |
tc_cache_sz = 0; | |
MallocExtension::instance()-> | |
GetNumericProperty("tcmalloc.max_total_thread_cache_bytes", | |
&tc_cache_sz); | |
cout << "Tcmalloc default thread cache size:" << tc_cache_sz << endl; | |
tc_cache_sz = 134217728; | |
MallocExtension::instance()-> | |
SetNumericProperty("tcmalloc.max_total_thread_cache_bytes", | |
tc_cache_sz); | |
MallocExtension::instance()-> | |
GetNumericProperty("tcmalloc.max_total_thread_cache_bytes", | |
&tc_cache_sz); | |
cout << "Tcmalloc runtime thread cache size:" << tc_cache_sz << endl; | |
} | |
/* EOF */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment