2009-11-24 16:36:31 -07:00
|
|
|
# Copyright (C) 2006 MySQL AB, 2009 Sun Microsystems, Inc
|
2006-12-31 02:29:11 +01:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
2007-08-03 11:06:53 +02:00
|
|
|
|
2009-11-09 12:32:48 +01:00
|
|
|
|
|
|
|
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys)
|
2007-08-03 11:06:53 +02:00
|
|
|
|
2010-07-23 17:14:35 -03:00
|
|
|
SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c default.c
|
2010-07-25 19:30:18 +02:00
|
|
|
errors.c hash.c list.c md5.c mf_cache.c mf_dirname.c mf_fn_ext.c
|
2006-01-31 07:52:16 -06:00
|
|
|
mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c
|
|
|
|
mf_keycaches.c mf_loadpath.c mf_pack.c mf_path.c mf_qsort.c mf_qsort2.c
|
2009-10-06 13:04:51 +02:00
|
|
|
mf_radix.c mf_same.c mf_sort.c mf_soundex.c mf_arr_appstr.c mf_tempdir.c
|
2010-07-23 17:14:35 -03:00
|
|
|
mf_tempfile.c mf_unixpath.c mf_wcomp.c mulalloc.c my_access.c
|
2010-07-25 19:30:18 +02:00
|
|
|
my_aes.c my_alloc.c my_bit.c my_bitmap.c my_chsize.c
|
|
|
|
my_compress.c my_copy.c my_create.c my_delete.c
|
2006-01-31 07:52:16 -06:00
|
|
|
my_div.c my_error.c my_file.c my_fopen.c my_fstream.c my_gethostbyname.c
|
|
|
|
my_gethwaddr.c my_getopt.c my_getsystime.c my_getwd.c my_handler.c my_init.c
|
2010-07-25 19:30:18 +02:00
|
|
|
my_lib.c my_lock.c my_malloc.c my_mess.c
|
2010-07-23 17:14:35 -03:00
|
|
|
my_mkdir.c my_mmap.c my_once.c my_open.c my_pread.c my_pthread.c
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
2010-07-08 18:20:08 -03:00
|
|
|
my_quick.c my_read.c my_redel.c my_rename.c my_seek.c my_sleep.c
|
2009-11-09 12:32:48 +01:00
|
|
|
my_static.c my_symlink.c my_symlink2.c my_sync.c my_thr_init.c
|
|
|
|
my_write.c ptr_cmp.c queues.c stacktrace.c
|
Bug#34043: Server loops excessively in _checkchunk() when safemalloc is enabled
Essentially, the problem is that safemalloc is excruciatingly
slow as it checks all allocated blocks for overrun at each
memory management primitive, yielding a almost exponential
slowdown for the memory management functions (malloc, realloc,
free). The overrun check basically consists of verifying some
bytes of a block for certain magic keys, which catches some
simple forms of overrun. Another minor problem is violation
of aliasing rules and that its own internal list of blocks
is prone to corruption.
Another issue with safemalloc is rather the maintenance cost
as the tool has a significant impact on the server code.
Given the magnitude of memory debuggers available nowadays,
especially those that are provided with the platform malloc
implementation, maintenance of a in-house and largely obsolete
memory debugger becomes a burden that is not worth the effort
due to its slowness and lack of support for detecting more
common forms of heap corruption.
Since there are third-party tools that can provide the same
functionality at a lower or comparable performance cost, the
solution is to simply remove safemalloc. Third-party tools
can provide the same functionality at a lower or comparable
performance cost.
The removal of safemalloc also allows a simplification of the
malloc wrappers, removing quite a bit of kludge: redefinition
of my_malloc, my_free and the removal of the unused second
argument of my_free. Since free() always check whether the
supplied pointer is null, redudant checks are also removed.
Also, this patch adds unit testing for my_malloc and moves
my_realloc implementation into the same file as the other
memory allocation primitives.
2010-07-08 18:20:08 -03:00
|
|
|
rijndael.c sha1.c string.c thr_alarm.c thr_lock.c thr_mutex.c
|
2010-07-23 17:14:35 -03:00
|
|
|
thr_rwlock.c tree.c typelib.c base64.c my_memmem.c my_getpagesize.c
|
2009-11-17 21:29:26 -07:00
|
|
|
lf_alloc-pin.c lf_dynarray.c lf_hash.c
|
2009-11-24 16:36:31 -07:00
|
|
|
my_atomic.c my_getncpus.c
|
|
|
|
my_rdtsc.c)
|
CMakeLists.txt (many), win/README, mysql_manifest.cmake, configure.js:
Additional changes for bug#29903
- Changed to do embedded build part as normal build, when
WITH_EMBEDDED_SERVER is set.
- Allow both normal and debug build with embedded.
- Build static embedded library by pointing out all source and compile
it all, i.e. not building libraries from libraries, not portable.
- Let embedded use generated files from the "sql" directory, added
dependencies to make sure built before embedded.
- Mark library "dbug" in TARGET_LINK_LIBRARIES() with "debug", so only
linked in when debug target is used.
- Removed change of target name with "mysqld${MYSQLD_EXE_SUFFIX}", as
others can't depend on it, not defined at configure time. Instead
set the output file name.
- Created work around for bug in CMake 2.4.6 and output names, to
set the "mysqld<suffix>.pdb" name to the same base name.
- Set the correct manifest "name" (patch by iggy)
2007-08-06 23:16:01 +02:00
|
|
|
|
2009-11-09 12:32:48 +01:00
|
|
|
IF (WIN32)
|
|
|
|
SET (MYSYS_SOURCES ${MYSYS_SOURCES} my_winthread.c my_wincond.c my_winerr.c my_winfile.c my_windac.c my_conio.c)
|
|
|
|
ENDIF()
|
|
|
|
|
2010-07-25 19:30:18 +02:00
|
|
|
IF(HAVE_ALARM)
|
|
|
|
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_alarm.c)
|
|
|
|
ENDIF()
|
|
|
|
|
2010-02-22 20:55:27 +01:00
|
|
|
IF(NOT HAVE_CXX_NEW)
|
2009-11-09 12:32:48 +01:00
|
|
|
# gcc as C++ compiler does not have new/delete
|
|
|
|
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_new.cc)
|
|
|
|
ADD_DEFINITIONS( -DUSE_MYSYS_NEW)
|
|
|
|
ENDIF()
|
|
|
|
|
2009-12-01 18:28:13 +00:00
|
|
|
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_C_COMPILER_ID MATCHES "SunPro")
|
2009-11-30 01:49:26 +00:00
|
|
|
# Inline assembly template for rdtsc
|
2009-12-01 18:28:13 +00:00
|
|
|
SET_SOURCE_FILES_PROPERTIES(my_rdtsc.c
|
|
|
|
PROPERTIES COMPILE_FLAGS "${CMAKE_CURRENT_SOURCE_DIR}/my_timer_cycles.il")
|
2009-11-30 01:49:26 +00:00
|
|
|
ENDIF()
|
|
|
|
|
2009-11-09 12:32:48 +01:00
|
|
|
IF(HAVE_LARGE_PAGES)
|
|
|
|
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_largepage.c)
|
|
|
|
ENDIF()
|
|
|
|
|
2010-07-25 19:30:18 +02:00
|
|
|
IF(HAVE_MLOCK)
|
|
|
|
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_lockmem.c)
|
|
|
|
ENDIF()
|
|
|
|
|
2009-11-09 12:32:48 +01:00
|
|
|
IF(UNIX)
|
|
|
|
# some workarounds
|
|
|
|
SET(MYSYS_SOURCES ${MYSYS_SOURCES} my_port.c)
|
|
|
|
ENDIF()
|
2010-07-25 19:30:18 +02:00
|
|
|
|
2009-11-24 23:15:47 +00:00
|
|
|
ADD_CONVENIENCE_LIBRARY(mysys ${MYSYS_SOURCES})
|
2009-12-07 02:16:05 +01:00
|
|
|
TARGET_LINK_LIBRARIES(mysys dbug strings ${ZLIB_LIBRARY}
|
2009-12-19 03:21:49 +01:00
|
|
|
${LIBNSL} ${LIBM} ${LIBRT})
|
2009-11-09 12:32:48 +01:00
|
|
|
DTRACE_INSTRUMENT(mysys)
|
2010-06-01 14:13:56 +04:00
|
|
|
|
|
|
|
ADD_EXECUTABLE(thr_lock thr_lock.c)
|
|
|
|
TARGET_LINK_LIBRARIES(thr_lock mysys)
|
|
|
|
SET_TARGET_PROPERTIES(thr_lock PROPERTIES COMPILE_FLAGS "-DMAIN")
|