issue-626: Fix SetupAggressiveDecommit initialization

This patch fixes the SetupAggressiveDecommit initialization to run after
pageheap_ creation.  Current code it not enforcing it, since
InitStaticVars is being called outside the static_vars module.
This commit is contained in:
Adhemerval Zanella 2014-06-03 07:50:56 -05:00
parent 846b775dfa
commit 81d99f21ed
1 changed files with 1 additions and 7 deletions

View File

@ -96,6 +96,7 @@ void Static::InitStaticVars() {
// in is caches as pointers that are sources of heap object liveness,
// which leads to it missing some memory leaks.
pageheap_ = new (MetaDataAlloc(sizeof(PageHeap))) PageHeap;
pageheap_->SetAggressiveDecommit(EnvToBool("TCMALLOC_AGGRESSIVE_DECOMMIT", false));
DLL_Init(&sampled_objects_);
Sampler::InitStatics();
}
@ -114,11 +115,4 @@ REGISTER_MODULE_INITIALIZER(tcmalloc_fork_handler, SetupAtForkLocksHandler());
#endif
static
void SetupAggressiveDecommit()
{
Static::pageheap()->SetAggressiveDecommit(EnvToBool("TCMALLOC_AGGRESSIVE_DECOMMIT", false));
}
REGISTER_MODULE_INITIALIZER(tcmalloc_setup_aggressive_decommit, SetupAggressiveDecommit());
} // namespace tcmalloc