From 3b6bc8573603c663ba35129555615cc8ff5c1250 Mon Sep 17 00:00:00 2001 From: "jar@chromium.org" Date: Mon, 21 Nov 2011 20:00:58 +0000 Subject: Put TCMalloc cleanup near the end of destructor list Try to make sure that the destructor at thread termination for TCMalloc is called later than most any other destructors. If other destructors are called later, and if they use malloc, then TCMalloc will start a new instance, and never cleanup :-( r=rvargas BUG=103209 Review URL: http://codereview.chromium.org/8550005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110987 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/tcmalloc/chromium/src/windows/port.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/third_party/tcmalloc/chromium/src/windows/port.cc b/third_party/tcmalloc/chromium/src/windows/port.cc index e77468c..44245e1 100644 --- a/third_party/tcmalloc/chromium/src/windows/port.cc +++ b/third_party/tcmalloc/chromium/src/windows/port.cc @@ -154,7 +154,8 @@ static void NTAPI on_tls_callback(HINSTANCE h, DWORD dwReason, PVOID pv) { extern "C" { // This tells the linker to run these functions. #pragma data_seg(push, old_seg) -#pragma data_seg(".CRT$XLB") + // Use CRT$XLY instead of CRT$XLB to ensure we're called LATER in sequence. +#pragma data_seg(".CRT$XLY") void (NTAPI *p_thread_callback_tcmalloc)( HINSTANCE h, DWORD dwReason, PVOID pv) = on_tls_callback; #pragma data_seg(".CRT$XTU") -- cgit v1.1