Hi, Michael! On Dec 11, Michael Widenius wrote:
revision-id: a36f27e200e (mariadb-10.5.2-275-ga36f27e200e) parent(s): 9f2bbf84e8d author: Michael Widenius <michael.widenius@gmail.com> committer: Michael Widenius <michael.widenius@gmail.com> timestamp: 2020-09-24 17:26:40 +0300 message:
Fixes that enables my_new.cc (new wrapper using my_malloc)
This is not enabled by default as there are leaks in the server that needs to be fixed first. One can compile with -DREALLY_USE_MYSYS_NEW -DSF_REMEMBER_FRAMES=14 to find the memory leaks from 'new'
The change in my_new.cc is ok. The change in my_global.h and CMakeLists.txt is confusing and redundant. You unconditionaly define USE_MYSYS_NEW then conditionally undefine it again? Everything already worked just fine. By default cxx new is used, if one wants to use mysys version, it's done with -DHAVE_CXX_NEW=0 this works for me in 10.5 and fails to compile my_new.cc, as it should. Please, only keed your my_new.cc changes and say in the commit message "One can compile with -DHAVE_CXX_NEW=0 to find memory leaks from 'new'" As for -DSF_REMEMBER_FRAMES=14, perhaps it's better to do it automatically? Like #ifdef USE_MYSYS_NEW #define SF_REMEMBER_FRAMES 14 #else #define SF_REMEMBER_FRAMES 8 #endif or may be even just always make it 14. It should be easy to enable this feature, right?
diff --git a/CMakeLists.txt b/CMakeLists.txt index 80fac4b2ccc..f97a6354f19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,10 +362,8 @@ ENDIF() # Run platform tests INCLUDE(configure.cmake)
-# force -DUSE_MYSYS_NEW unless already done by HAVE_CXX_NEW -IF(NOT HAVE_CXX_NEW) - ADD_DEFINITIONS(-DUSE_MYSYS_NEW) -ENDIF() +# Always use USE_MYSYS_NEW +ADD_DEFINITIONS(-DUSE_MYSYS_NEW)
# Find header files from the bundled libraries # (wolfssl, readline, pcre2, etc) diff --git a/include/my_global.h b/include/my_global.h index 86ef5f882f6..8862a397f73 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -527,6 +527,9 @@ typedef unsigned short ushort; duplicate declaration of __cxa_pure_virtual, solved by declaring it a weak symbol. */ +#ifndef REALLY_USE_MYSYS_NEW +#undef USE_MYSYS_NEW +#endif #if defined(USE_MYSYS_NEW) && ! defined(DONT_DECLARE_CXA_PURE_VIRTUAL) C_MODE_START int __cxa_pure_virtual () __attribute__ ((weak));
Regards, Sergei VP of MariaDB Server Engineering and security@mariadb.org