From d4c9ff957b2e7a484accc65d49a80ae4638deb9d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 25 Feb 2011 17:05:17 +0100 Subject: MBUG#688404 : Fix pbxt crashes on Windows 64 in debug build The reason for the crash is misalignment on SSE instruciton in setjmp(). The root cause is PBXT debug malloc(), which unlike OS malloc does not guarantee 16 bytes alignment. So the fix for now is disable PBXT debug malloc on Windows. It was obsolete anyway, as it does not provide additional benefits to C runtime debug routines (always used in debug compilation) or to pageheap, available at runtime. --- storage/pbxt/src/memory_xt.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'storage/pbxt/src') diff --git a/storage/pbxt/src/memory_xt.h b/storage/pbxt/src/memory_xt.h index 1785cd0bd51..bfc7990f914 100644 --- a/storage/pbxt/src/memory_xt.h +++ b/storage/pbxt/src/memory_xt.h @@ -29,8 +29,21 @@ struct XTThread; -#ifdef DEBUG -#define DEBUG_MEMORY +#if (defined DEBUG) +/* + Disable PBXT debug malloc on Windows, as it is not properly aligned. + malloc() alignment requiremebt on x64 is documented as 16 bytes. PBXT debug + malloc is only 8 bytes aligned. Improper alignment will lead to a crash if + e.g SSE instructions access heap memory. + + This might be general problem , however crashes were seen so far only + on Windows (crash during setjmp() on memory allocated with pbxt debug malloc). + + Besides, on Windows there is already a debug malloc by C runtime. +*/ +#ifndef _WIN32 + #define DEBUG_MEMORY +#endif #endif #ifdef DEBUG_MEMORY -- cgit v1.2.1