181 Commits

Author SHA1 Message Date
Jarred Sumner
d2e727f0e8 Add MI_SKIP_COLLECT_ON_EXIT flag 2022-01-18 21:11:12 -08:00
Daan Leijen
2cc400d600 update comment 2022-01-10 16:53:19 -08:00
Daan Leijen
05c2a51211 merge from master 2022-01-10 16:20:22 -08:00
akarin
3d91c0e737 cmake: export mimalloc-static as well
Otherwise a static only build would not be usable as cmake package
(as mimalloc.cmake wouldn't be generated).

Signed-off-by: akarin <i@akarin.info>
2021-12-26 18:17:53 +09:00
Frank Richter
969f3a6998 Add tests for zero-initialization functions 2021-12-21 16:20:56 +01:00
Frank Richter
51271ba8ea Replace redundant CMake code for tests with a loop 2021-12-21 12:54:15 +01:00
daan
ee3ae2a425 add deprecated notice 2021-12-15 08:53:55 -08:00
daan
144b4a2d3e link with libatomic automatically if found 2021-12-15 08:42:58 -08:00
daan
b7d33c2c33 fix MI_ prefix for libraries 2021-12-15 08:41:52 -08:00
Daan
69b6b24688 further improvements to installation directories 2021-12-14 18:29:14 -08:00
Daan
1bbc184082
Merge pull request #493 from viy2/pull_request_on_dev
Pull request for issue #490:  set SOVERSION for mimalloc shared lib
2021-12-13 17:26:12 -08:00
Daan
d575aacfde use find_library for pthread (issue #496) 2021-12-13 13:10:33 -08:00
Igor Vlasenko
acc64ee5cd added SOVERSION to mimalloc shared lib (issue #490)
This is a portability improvement.
A cross-platform library needs SOVERSION field for Unix platforms.
With SOVERSION field cmake itself will do proper management of
libmimalloc.so.SOVERSION -> libmimalloc.so.VERSION symlink on Unix,
so a piece of code that tried to emulate this behavior manually
is no more needed and is removed here too.
2021-11-28 19:59:09 +02:00
daan
1c22650719 remove no-invalid-memory-model supression 2021-11-15 10:52:09 -08:00
Daan
5e55525e5e
Merge pull request #483 from joy4eg/install-dirs-dev
cmake: removed hardcoded names for top level configuration
2021-11-14 14:49:48 -08:00
daan
c56be7ac5a show cflags in cmake; fix -fno-builtin-malloc flag 2021-11-13 13:30:03 -08:00
Daan
c47de7eb90 improve macOS overriding 2021-11-04 18:55:12 -07:00
Daan
32ee13f41e improve macOS M1 performance; use interpose in combination with zone's; add -fno-builtin-malloc flag in building with MI_OVERRIDE 2021-11-02 21:54:44 -07:00
Yaroslav Syrytsia
0ead911b6b cmake: removed hardcoded names for top level configuration 2021-10-28 12:04:48 +03:00
Daan
e02f88a11c Fix warnings with g++-11 compilation 2021-10-20 09:55:03 -07:00
Daan
4d89176eb4 add MI_USE_LIBATOMIC to link with -latomic on older systems (see also PR #429); rename MI_INTERPOSE to MI_OSX_INTERPOSE 2021-10-20 09:35:58 -07:00
Daan
2d821003b0 don't add prefix if build type is None (PR #427) 2021-10-19 10:56:13 -07:00
Daan
b4a5c8459d
Merge pull request #461 from objectx/patch-1
fix: Fix a typo
2021-10-19 10:25:16 -07:00
Daan
60937b5bc8 add -Wstrict-prototypes flag during compilation 2021-10-19 09:39:33 -07:00
Masashi Fujita
9ee780894a
fix: Fix a typo 2021-09-16 03:35:56 +09:00
Daan Leijen
a83bca72b3 fixes for M1; disable interpose use zones; fix pedantic warnings 2021-06-17 19:15:09 -07:00
Daan Leijen
c8b5b74500 improve warnings 2021-06-07 17:51:27 -07:00
Daan Leijen
4ba32c3160 Revert "make all includes relative"
This reverts commit 1feb6123d90f5557a0fc1bc2afc72401e58f8cb0.
2021-06-07 16:47:57 -07:00
Daan Leijen
1feb6123d9 make all includes relative 2021-06-06 20:31:36 -07:00
Daan Leijen
e2c095fad2 fix installation directories on unix to use /lib, /include, /share; fix issues #399, #223, and #89 2021-05-21 15:15:50 -07:00
Daan Leijen
34172910e5 fix symlink and --prefix option with delayed CMAKE_INSTALL_PREFIX; fix issue #398 2021-05-21 13:01:11 -07:00
Daan
143cf9c3d6
Merge pull request #400 from mkurdej/redirect32
[Windows] Correctly choose 32-bit version of mimalloc-redirect{,32}.dll in CMake.
2021-05-21 12:17:33 -07:00
Yupeng Zhang
712e7d3de0 [CMake] Respect CMAKE_INSTALL_PREFIX at install time
The standard way of cmake install to a destination folder is the following pattern:
```shell
cd <BUILD_DIR>
cmake <SRC_DIR>
cmake --build <BUILD_DIR>
cmake --install <BUILD_DIR> --prefix <INSTALL_DIR>
```
Right now, the `<INSTALL_DIR>` folder passed in cmake --install command is ignored,
and always installed into `C:/Program Files(x86)/...`, which is the default
`CMAKE_INSTALL_PREFIX` value passed at the `cmake <SRC_DIR>` call.
Thus, it is not possible to install the binaries into different folders
without rerun the cmake/build process.

The important thing here is, the cmake variable `CMAKE_INSTALL_PREFIX`
is supposed to be passed at `cmake --install` time with the `--prefix` argument.
In cmake file, `install` with relative path will use that prefix automaticlly.
And it is the best practice to not include CMAKE_INSTALL_PREFIX
in the `install(... DESTINATION )` argument:
```
In particular, there is no need to make paths absolute by prepending
CMAKE_INSTALL_PREFIX; this prefix is used by default if the DESTINATION is a relative path.
```
referenced from: https://cmake.org/cmake/help/latest/command/install.html
2021-05-10 12:01:03 -04:00
Marek Kurdej
acba250e60 [Windows] Correctly choose 32-bit version of mimalloc-redirect{,32}.dll. 2021-05-04 11:26:07 +02:00
Daan Leijen
9f3c29c642 remove -march=native flag; see pr #362 for discussion 2021-02-22 13:09:41 -08:00
Daan Leijen
5291487dac fix cmake typo in merge for #255 2021-01-29 15:52:18 -08:00
Daan
71d80e914d
Merge branch 'dev' into patch-1 2021-01-29 15:49:57 -08:00
Tarcisio Rodrigues
eb5613563b Add /Zc:__cplusplus to MSVC compiler flags
Fix build errors for a clean build on Windows. For details about the
CMake teting code see https://stackoverflow.com/a/60890947/1254880
2021-01-28 23:58:41 -03:00
Tarcisio Rodrigues
335fbd9a43 Avoid MATCHES operator to check CMake options
Instead use simply the option name in conditional contexts.
2021-01-22 19:49:19 -03:00
Uwe L. Korn
62b6ccb03e Check for march=native before using it 2020-12-15 11:03:20 +01:00
Uwe L. Korn
d7f3d7679a Don't set march=native on Apple Silicon 2020-12-15 10:20:58 +01:00
daan
c86459afef split bitmap code into separate header and source file 2020-09-08 10:14:13 -07:00
daan
f7b94fe21c experiment with bcrypt api again 2020-09-06 08:33:27 -07:00
daan
e740242978 link with advapi32 on windows 2020-09-06 08:29:08 -07:00
daan
53cbc68de3 display compiler in cmake summary 2020-07-26 00:21:10 -07:00
daan
95afd0509f make segment abandoned_next atomic; tsan passes without warnings now (issue #130) 2020-07-25 23:50:22 -07:00
daan
73c109a04e add cmake option to build with ubsan 2020-07-25 19:55:36 -07:00
daan
529d74a282 use O1 with thread sanitizer 2020-07-22 12:45:53 -07:00
Daan
56b58a8021
Merge pull request #267 from devnexen/haiku_support
haiku support.
2020-07-21 18:32:40 -07:00
daan
01da026314 add option to build with thread sanitizer 2020-07-21 09:10:45 -07:00
David Carlier
7e48eb033c haiku support.
TLS unsupported thus disabled.
2020-06-28 13:53:45 +00:00
Uwe L. Korn
1f08317f3c Add option to install directly in CMAKE_INSTALL_PREFIX 2020-05-30 10:36:37 +02:00
daan
fd9faee5d4 update cmake with nicer message which targets are build 2020-05-04 11:01:11 -07:00
Daan
ff4f1c3e5d
Merge branch 'dev' into cmake-build-variants 2020-05-04 09:51:09 -07:00
Daan
866fd0e8f5
Merge pull request #240 from andronat/master
Use position independent code (PIC) for static and object libraries.
2020-05-01 14:15:17 -07:00
Anastasios Andronidis
5c03e9dc79 Compile static and obj targets with PIC 2020-05-01 21:53:51 +01:00
daan
9a33f23b5f fix MI_SHOW_ERRORS on msvc 2020-04-28 11:11:23 -07:00
Daan
07e80aebb7
Merge branch 'dev' into xmalloc 2020-04-28 10:53:34 -07:00
Daan
9ba16f2df9
Merge pull request #232 from asl/cmake-err-warn-default
Add cmake option to specify whether warnings / errors are enabled by default
2020-04-28 10:51:30 -07:00
Anton Korobeynikov
d4363bbaf8 Add possibility to selectively enable / disable builing of different targets. 2020-04-28 18:12:43 +03:00
Anton Korobeynikov
079b886feb Add cmake option to specify whether warnings / errors are enabled by default.
Currently warnings / errors are enabled by default in debug build.
Otherwise they could be enabled only via environmental variable or
API option call. Add possibility to specify the default during the
build time. This simplifies e.g. integration of the library into
bigger projects as no source changes would be required.
2020-04-28 16:44:44 +03:00
Anton Korobeynikov
2f1fc1df5c Add xmalloc()-like functionality.
xmalloc is a non-standard extension forcing malloc() to
abort should the memory allocation failed instead of returning a
null pointer. Such functionality is quite useful as it provides one
single point of error handling if the caller of malloc() does not
check the result (as it often does!) and segfault is ocurring somewhere
else. If more fine-grained control is necessary one could register a custom
error handler, however, this might not be an option while interposing.
2020-04-28 16:38:47 +03:00
Anton Korobeynikov
07d72f4fba Do not forget to include malloc zone implementation in the static object 2020-04-21 15:08:27 +03:00
David Carlier
80aeb1bd1d Fix compiler detection 2020-04-15 05:34:07 +01:00
David Carlier
6c5039bad1 Android build fix proposal.
malloc_usable_size has different signature on this platform.
thread and real time apis are part of bionic.
2020-04-14 14:20:56 +01:00
daan
69a0846478 add MI_PADDING flag to cmake to supress use of padding in debug mode 2020-04-07 10:01:18 -07:00
David Carlier
2884affbd7 Using host data rather. 2020-03-07 12:19:48 +00:00
David Carlier
854e81c11d build fix for arm, adding native arch flag to be able to generate
yield asm instruction.
2020-03-07 09:18:45 +00:00
Orkhan Hasanli
b41183e8a3 Creation of symbolic link was failing. #166 2020-03-04 20:45:20 -05:00
daan
9062f39764 enable interpose separate from zones on macOS 2020-02-08 20:08:52 -08:00
daan
03b363a1c2 first working tls on macOS using interpose; still slow 2020-01-29 22:46:44 -08:00
daan
4faf412f53 move 'memory.c' to 'region.c' 2020-01-25 13:28:49 -08:00
daan
6fb434a99b use -fvisibility=hidden on clang as well 2020-01-23 10:31:47 -08:00
daan
9d7ac76d93 fix compilation under Intel C compiler (icc) 2020-01-19 18:35:45 -08:00
daan
dbe721de39 dont compile test-stress.c as C++ code (or we get atomic compilation errors) 2020-01-17 15:45:12 -08:00
daan
f4ee1760b8 Suppress C source compiled as C++ warning on clang 2020-01-17 15:39:41 -08:00
daan
ba87a39d9f updated random cookie generation using OS primitives and chacha20 2019-12-22 19:37:49 -08:00
daan
6568059cc6 merge from dev 2019-11-21 16:28:28 -08:00
daan
74dbfc30be improved security by encoding NULL values; double free mitigation on by default; more precise free list corruption detection 2019-11-21 15:21:23 -08:00
Daan Leijen
56b9fac4bf merge from dev 2019-11-20 13:31:04 -08:00
Daan Leijen
dccffea662 fix pr #173 by @zerodefect to use case-insensitive matching of the build type; also use MI_DEBUG_FULL option (instead of MI_CHECK_FULL) 2019-11-14 11:01:05 -08:00
daan
17ade3fca5 merge from dev 2019-11-13 17:52:20 -08:00
daan
d4f54dcf30 remove numaif dependency on linux 2019-11-12 10:37:15 -08:00
Daan Leijen
f0e02bab03 pr #168 by @zerodefect to update the install location 2019-11-08 12:22:03 -08:00
daan
6ccfb5a93e merge from dev 2019-11-07 11:00:50 -08:00
daan
56887aeb2f add MI_SECURE_FULL=ON as a cmake option to include double free mitigation 2019-11-07 10:59:45 -08:00
daan
378716c467 refactor and improve atomic bitmap usage 2019-11-07 10:26:52 -08:00
daan
9d6a5acb22 fix unix build warnings 2019-11-03 13:34:54 -08:00
daan
2c12d7f223 optimized numa calls; better Linux support 2019-11-01 22:01:52 -07:00
daan
2d10c78587 fix linux compilation 2019-11-01 20:19:00 -07:00
daan
2affdbbd2e stronger secure mode when defining MI_SECURE=4: checks for double free, corrupted free list, and invalid pointer frees. Performance is impacted but not too much -- more perf testing is needed 2019-10-18 18:11:04 -07:00
daan
3a697abf1f set SONAME and use symbolic link at install (issue #9 and #58) 2019-09-15 20:26:30 -07:00
daan
33f4ec4ac6 put new-delete overrides in separate header file 2019-09-15 19:19:00 -07:00
daan
efe083a548 Merge branch 'master' into dev 2019-09-09 08:06:35 -07:00
Antoine Pitrou
b69a4b52c0 Fix #147: provide CMake option for alternate TLS mechanism
This allows use of dlopen() with mimalloc on Unix.
2019-09-04 12:02:16 +02:00
daan
d7982f8733 make output name not depend on build type capitalization (issue #144) 2019-09-02 09:57:39 -07:00
daan
8ef8ddecc5 Merge branch 'master' into dev 2019-09-02 09:53:34 -07:00
Antoine Pitrou
cbc392434c Add an option to disable building tests 2019-08-28 17:26:56 +02:00
daan
cf7bb70117 Merge branch 'master' into dev 2019-08-27 10:01:20 -07:00
Jim Huang
99e071cf2c Link with -lrt for older glibc
Quoted from Linux Programmer's Manual (2017-09-15):
    #include <time.h>
    int clock_gettime(clockid_t clk_id, struct timespec *tp);
    Link with -lrt (only for glibc versions before 2.17).

This patch adds additional checks for librt availability and append
target_link_libraries accordingly. librt is absent on macOS.

Fixed #139
2019-08-24 21:24:56 +08:00