Compile time aggressive decommit option
[alkondratenko@gmail.com: performed s/agressive/aggressive/g] Signed-off-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
This commit is contained in:
parent
e9ab4c5304
commit
5574c87e39
11
configure.ac
11
configure.ac
|
@ -667,6 +667,17 @@ AC_ARG_ENABLE([large-alloc-report],
|
|||
AS_IF([test "x$enable_large_alloc_report" = xyes],
|
||||
[AC_DEFINE([ENABLE_LARGE_ALLOC_REPORT], 1, [report large allocation])])
|
||||
|
||||
# Enable aggressive decommit by default
|
||||
AC_ARG_ENABLE([aggressive-decommit-by-default],
|
||||
[AS_HELP_STRING([--enable-aggressive-decommit-by-default],
|
||||
[enable aggressive decommit by default])],
|
||||
[enable_aggressive_decommit_by_default="$enableval"],
|
||||
[enable_aggressive_decommit_by_default=no])
|
||||
AS_IF([test "x$enable_aggressive_decommit_by_default" = xyes],
|
||||
[AC_DEFINE([ENABLE_AGGRESSIVE_DECOMMIT_BY_DEFAULT],
|
||||
1,
|
||||
[enable aggressive decommit by default])])
|
||||
|
||||
# Write generated configuration file
|
||||
AC_CONFIG_FILES([Makefile
|
||||
src/gperftools/tcmalloc.h src/windows/gperftools/tcmalloc.h])
|
||||
|
|
|
@ -91,9 +91,17 @@ void Static::InitStaticVars() {
|
|||
|
||||
new (&pageheap_.memory) PageHeap;
|
||||
|
||||
#if defined(ENABLE_AGGRESSIVE_DECOMMIT_BY_DEFAULT)
|
||||
const bool kDefaultAggressiveDecommit = true;
|
||||
#else
|
||||
const bool kDefaultAggressiveDecommit = false;
|
||||
#endif
|
||||
|
||||
|
||||
bool aggressive_decommit =
|
||||
tcmalloc::commandlineflags::StringToBool(
|
||||
TCMallocGetenvSafe("TCMALLOC_AGGRESSIVE_DECOMMIT"), false);
|
||||
TCMallocGetenvSafe("TCMALLOC_AGGRESSIVE_DECOMMIT"),
|
||||
kDefaultAggressiveDecommit);
|
||||
|
||||
pageheap()->SetAggressiveDecommit(aggressive_decommit);
|
||||
|
||||
|
|
Loading…
Reference in New Issue