Commit 9a07441f authored by Mao Huang's avatar Mao Huang Committed by Commit Bot

tcmalloc: Don't let tcmalloc read all kinds of env vars at startup.

Original CL:

- https://codereview.chromium.org/281613004

  Don't let tcmalloc read all kinds of env vars at startup.

  The env vars are still used in profiling=1 builds, by such illustrious
  figures as the deep memory profiler bot and willchan. Reading from the
  environment variables uses static initializers, so this change will
  eliminate those static initializers in profiling=0 builds.

  As discussed in the chromium-dev thread "Does anyone use tcmalloc's
  debugging envvars?".

  BUG=94925
  NOTRY=true

BUG=724399,b:70905156

Change-Id: Ic143dfca456a3475be0938af53c0eb4308f457d1
Reviewed-on: https://chromium-review.googlesource.com/1130780Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Commit-Queue: Gabriel Marin <gmx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579496}
parent 6e3dc073
...@@ -157,6 +157,8 @@ namespace tcmalloc { ...@@ -157,6 +157,8 @@ namespace tcmalloc {
// These macros (could be functions, but I don't want to bother with a .cc // These macros (could be functions, but I don't want to bother with a .cc
// file), make it easier to initialize flags from the environment. // file), make it easier to initialize flags from the environment.
#if defined(ENABLE_PROFILING)
#define EnvToString(envname, dflt) \ #define EnvToString(envname, dflt) \
(!getenv(envname) ? (dflt) : getenv(envname)) (!getenv(envname) ? (dflt) : getenv(envname))
...@@ -172,4 +174,14 @@ namespace tcmalloc { ...@@ -172,4 +174,14 @@ namespace tcmalloc {
#define EnvToDouble(envname, dflt) \ #define EnvToDouble(envname, dflt) \
tcmalloc::commandlineflags::StringToDouble(getenv(envname), dflt) tcmalloc::commandlineflags::StringToDouble(getenv(envname), dflt)
#else // defined(ENABLE_PROFILING)
#define EnvToString(envname, dflt) (dflt)
#define EnvToBool(envname, dflt) (dflt)
#define EnvToInt(envname, dflt) (dflt)
#define EnvToInt64(envname, dflt) (dflt)
#define EnvToDouble(envname, dflt) (dflt)
#endif // defined(ENABLE_PROFILING)
#endif // BASE_COMMANDLINEFLAGS_H_ #endif // BASE_COMMANDLINEFLAGS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment