Daan Leijen
aca46242ab
update comment for aligned_alloc
2021-04-28 12:47:14 -07:00
Daan
45a8dc7f55
Merge pull request #385 from elbaro/fix/aligned-alloc
...
Fix aligned_alloc
2021-04-28 12:43:32 -07:00
Jim Huang
5940d3bcce
Bump copyright date
...
Each source file has been changed according to relevant Git activities.
2021-04-24 16:35:11 +00:00
Jim Huang
52943917ad
Rewrite align_down with bitwise operations
...
mi_align_down_ptr was implemented with multiplication and division,
which can be converted to equivalent and deterministic bit operations.
2021-04-21 13:14:53 +00:00
Jim Huang
3402c6cc3f
Revise the use of macOS predefined macro
...
Quoted from "Porting UNIX/Linux Applications to OS X,"[1]
* macro __MACH__ is defined if Mach system calls are supported;
* macro __APPLE__ is defined in any Apple computer.
__MACH__ is not specific to macOS since GNU/Hurd runs on a Mach-based
microkernel (gnumach) [2]. __MACH__ is defined by the compiler,
leading to potential confusions. The solution is just changing the
checked identifier (i.e. __APPLE__), so it is really used only on
macOS.
[1] https://developer.apple.com/library/archive/documentation/Porting/Conceptual/PortingUnix/compiling/compiling.html
[2] https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html
2021-04-21 15:24:02 +08:00
elbaro
ad44f76598
commit
2021-04-11 03:09:23 +09:00
Daan Leijen
5f596056c9
use 2-6TiB area for hints to accommodate pre-windows8 better
2021-02-24 15:49:43 -08:00
Daan Leijen
e64474e06b
add virtiual gaps between hinted allocations in secure mode
2021-02-24 15:30:39 -08:00
Daan Leijen
9317256a4f
improved ASLR (issue #372 )
2021-02-24 15:14:17 -08:00
Daan Leijen
3228bb685f
set errno ENOMEM for limited arena allocation (issue #295 )
2021-02-22 14:17:25 -08:00
Daan Leijen
71ac98ab08
rename <Windows.h> include to <windows.h> for mingw compatibility (see pr #367 )
2021-02-22 13:04:11 -08:00
Daan Leijen
7962420697
fix bug in bitmap is_claimed_across; issue #368
2021-02-22 12:37:08 -08:00
Daan Leijen
c426ab4ea2
add condition to avoid compilation error on vs2015 (#issue 353)
2021-02-01 15:41:41 -08:00
Daan Leijen
0091a641a7
undo previous commit dcae918 due to wrong logic (issue #289 )
2021-02-01 09:55:18 -08:00
Daan Leijen
dcae918b84
always do ASLR in secure mode even in debug mode (issue #289 )
2021-02-01 09:49:12 -08:00
Daan Leijen
35c1fc2be9
limit memcpy as rep stosb to windows where the cpu supporst FSRM; add mi_memcpy_aligned for machine-word aligned copy. see issue #201 and pr #253
2021-01-30 14:33:46 -08:00
Daan
9b966c3492
Merge pull request #253 from haneefmubarak/memcpy-rep-movsb-windows-201
...
resolve #201 with a platform-selective REP MOVSB implementation
2021-01-29 16:00:00 -08:00
Daan Leijen
a6fa7b083e
make current stat the third column instead of first
2021-01-29 14:45:16 -08:00
Daan
fb9c6ce127
Merge pull request #327 from asl/stats-cur
...
Print current values of stat counters as well.
2021-01-29 14:35:13 -08:00
Daan Leijen
f68c1a74da
fix assertion comparison ( #353 )
2021-01-29 14:34:14 -08:00
Daan Leijen
a8b282091f
update formatting of statistics
2021-01-29 13:03:06 -08:00
Daan
b759bcf5c7
Merge pull request #329 from asl/mi_stat_agg
...
Unify statistics collection
2021-01-29 12:52:29 -08:00
Daan Leijen
bb386025b5
update override on macOS with interpose of malloc_default_zone (issues #313 )
2020-12-15 16:03:54 -08:00
unknown
745cf1e2f5
fix build on ghc4.8 (issue #330 )
2020-12-10 12:33:35 -08:00
unknown
d1d06b67eb
fix type warning (issue #337 )
2020-12-10 12:13:06 -08:00
unknown
b7087d3625
Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev
2020-12-10 11:57:16 -08:00
Daan
7958d0df57
Merge pull request #331 from devnexen/mi_bitmap_try_find_claim_field_accross_little_chg
...
mi_bitmap_try_find_claim_field_across
2020-12-10 11:57:08 -08:00
unknown
701da6b42e
Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev
2020-12-10 11:53:35 -08:00
Daan
9d0555c65b
Merge pull request #326 from asl/mi_stat_counter
...
Honour MI_STAT in couple more places
2020-12-10 11:53:30 -08:00
unknown
f37a3db37c
cleanup madv_resuable
2020-12-10 11:51:58 -08:00
unknown
cbc14a9287
count warnings and errors separately
2020-12-10 10:28:54 -08:00
Daan
56a1c852ea
Merge pull request #325 from asl/max-error-counter
...
Do not use the same counter for warnings and errors
2020-12-10 10:23:08 -08:00
David Carlier
bbdf470715
mi_bitmap_try_find_claim_field_across
...
number of leading zeros is unsigned.
2020-11-18 17:21:51 +00:00
Anton Korobeynikov
765fc9c0ca
Unify statistic collection:
...
- For MI_STAT == 0 no allocation stats are collected
- For MI_STAT == 1 only aggregated values (across normal, large and huge heaps) are collected
- For MI_STAT == 1 separate per-bin collection for normal heap is done as well
2020-11-11 11:41:39 +03:00
Anton Korobeynikov
00fb89f771
Rename the field
2020-11-11 11:41:33 +03:00
Anton Korobeynikov
d9a0624529
Print current values of stat counters as well.
...
For some reasons unknown to me the current values of stat counters are never printed.
This makes is quite hard to use printing during the debugging in the middle
of program run.
2020-11-02 00:24:24 +03:00
Anton Korobeynikov
39bcf8a6b0
Honour MI_STAT in couple more places.
2020-11-02 00:14:02 +03:00
Anton Korobeynikov
9c45221243
Do not use the same counter for warnings and errors.
...
Warnings happen normally and could be safely ignored in the most cases,
however errors, if enabled, should not be ignored. Currently since warnings
and errors share the same counter we effectively stop showing errors after
16 warnings (which happen all the time).
Use different counters for errors and warnings.
2020-11-01 23:57:42 +03:00
David Carlier
1deea03bf1
On Darwin, using MADV_FREE_REUSABLE/MADV_FREE_REUSE.
...
The former to notify the pages are available for other processes,
the latter is needed for proper counting in case those pages where
tagged as reusable previously otherwise is a no-op, all for better
RSS reporting for task_info apps.
2020-10-31 22:22:04 +00:00
daan
ca13e9cd59
better instruction scheduling for alloc
2020-10-15 19:46:33 -07:00
daan
69f935944f
add test to avoid searching arenas when possible
2020-10-15 19:46:19 -07:00
daan
6279835976
fix unused parameter warning
2020-10-11 13:22:14 -07:00
daan
7114d5424a
fix statistics to include padding correctly (issue #301 )
2020-10-11 13:14:43 -07:00
daan
5d2b925f3e
wrap MI_SECURE conditional in #ifdef to avoid warnings (issue #311 )
2020-10-11 10:56:57 -07:00
daan
ead1f34930
add extra NULL checks for heap parameters in the heap API (issue #311 )
2020-10-11 10:50:09 -07:00
daan
ed8cc1fc19
Merge branch 'master' into dev
2020-09-24 16:32:56 -07:00
daan
1233de7388
use relaxed load for region count as that is monotonic
2020-09-24 16:29:41 -07:00
daan
44d030ba9d
fuse used decrement with test for slightly better codegen
2020-09-24 16:28:25 -07:00
daan
9d5098c705
bump version to 1.6.7 for further development
2020-09-24 10:16:40 -07:00
daan
f88b4b4c27
extend mi_process_info to include elapsed time
2020-09-24 10:13:25 -07:00
daan
c05302f097
Merge branch 'dev' into dev-exp
2020-09-24 09:11:49 -07:00
Daan
6d47e65b78
Merge pull request #302 from devnexen/haiku_build_fix
...
Haiku build fix.
2020-09-14 09:11:25 -07:00
daan
d89c23efce
merge from dev
2020-09-14 09:03:52 -07:00
daan
840eba2874
improve handling of out-of-memory situations
2020-09-14 09:02:06 -07:00
Igor Kostenko
bf9c3bd088
Fix rare access violation on out of memory
2020-09-14 10:50:22 +01:00
David Carlier
568d6e532b
Haiku build fix.
...
Haiku does not provide page faults statistics only system wide.
2020-09-10 18:49:19 +00:00
daan
8607ff617c
add environment option mi_reserve_os_memory
2020-09-08 17:16:31 -07:00
daan
364674185e
add option to limit OS allocation and only allow allocation from arenas
2020-09-08 16:56:51 -07:00
daan
14b8d27386
track pinned memory separately from large os pages
2020-09-08 16:46:03 -07:00
daan
c86459afef
split bitmap code into separate header and source file
2020-09-08 10:14:13 -07:00
daan
30b993ecf3
consolidate bit scan operations
2020-09-08 09:27:57 -07:00
daan
c7272afa9a
add mi_reserve_os_memory/mi_manage_os_memory; allow arena allocations to cross multiple bitmap fields
2020-09-07 21:34:34 -07:00
daan
46ee8952eb
update mi_process_info to not use doubles
2020-09-06 13:53:02 -07:00
daan
ee286919d9
add mi_process_info api call
2020-09-06 13:21:19 -07:00
daan
9113281165
switch back to using bcryptrandom number generation on Windows to fix azure pipeline tests
2020-09-06 08:50:23 -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
1b571aea06
remove unused local warning
2020-09-05 22:03:47 -07:00
daan
f3f8afb580
add abandoned counter for debug purposes
2020-09-05 18:17:07 -07:00
daan
f09549c98f
use main stats for thread count
2020-09-05 18:00:36 -07:00
daan
1ce2e4cb05
use main stats for os statistics
2020-09-05 17:44:15 -07:00
daan
9d82b15d87
fix warnings on vs2017
2020-09-05 12:04:25 -07:00
daan
2e311f341b
fix msvc compilation in C mode
2020-09-05 09:37:09 -07:00
daan
50de0d2358
fix C++ compilation with new atomics
2020-09-05 09:17:42 -07:00
daan
2594b37c56
fix build warning on C++ template deduction on Linux
2020-09-05 08:36:34 -07:00
daan
ec2c83a633
fix whitespace
2020-09-04 14:20:13 -07:00
daan
032eb2a75a
use pragma warning only on msvc (issue #291 )
2020-09-04 13:06:18 -07:00
Daan
797c50e0c0
Merge pull request #296 from timblechmann/feature/iOS-compile-fix
...
iOS compile fix
2020-09-04 10:36:48 -07:00
daan
ff0d98883e
update comments
2020-09-03 10:00:01 -07:00
daan
900c97664a
merge from dev-atomic
2020-09-03 09:47:01 -07:00
daan
b4825372ab
small compilation warning fixes (extra semicolon etc)
2020-08-29 19:30:38 -07:00
Tim Blechmann
1190e0c053
iOS compile fix
...
`crt_externs.h` is available only available with iOS-13 sdk. we
therefore add a `__has_include` check to see if it is actually available
2020-08-26 11:47:24 +08:00
daan
3f8ff12e66
avoid use of %z format specifier
2020-08-15 11:42:28 -07:00
daan
5805c39916
enable --std=c99 compilation; fix mingw compilation
2020-08-09 17:55:17 -07:00
daan
d88a7470a0
merge from master
2020-08-06 13:19:01 -07:00
Gal Ben David
1583a73c66
Adding conditional _DEFAULT_SOURCE definition
...
In order to avoid `_DEFAULT_SOURCE` redefinition warnings, I've wrapped the define statement with an `ifndef`.
2020-08-06 14:29:25 +03:00
daan
9e7322f900
collect memory on process exit for statically linked library (issue #281
2020-07-29 21:27:01 -07:00
daan
47572aceca
improved NUMA node detection on Windows (for AMD Ryzen), issue #282
2020-07-29 14:36:21 -07:00
Daan
5da3ef4ca1
Merge pull request #280 from devnexen/haiku_stats
...
Haiku stats
2020-07-27 08:33:25 -07:00
Daan
3d0b91457e
Merge pull request #278 from devnexen/illumos_prevent_some_flags
...
some apis are available on Illumos which are not available on stock S…
2020-07-27 08:32:01 -07:00
daan
ef8e5d18a6
replace atomics with C11/C++ atomics with explicit memory order; passes tsan. Issue #130
2020-07-26 18:01:33 -07:00
daan
a468430772
strengthen memory order of bit operations; insert memory fences
2020-07-26 14:19:30 -07:00
daan
a9f46dc86f
reduce memory order constraints for better efficiency on ARM etc
2020-07-26 11:58:02 -07:00
daan
116159cd40
use RtlGenRandom on windows to enable compilation as C++ even with dynamic override
2020-07-26 11:57:14 -07:00
David Carlier
d964be2caa
getting resident mem at least
2020-07-26 18:56:10 +00:00
David Carlier
eb1188a1dd
Enables subset of stats for haiku.
2020-07-26 17:00:54 +00:00
daan
28014ee2bc
fix atomic access for MADV_FREE in os_reset
2020-07-26 00:16:17 -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
09ade02429
bring inline with C11 atomics; no volatile and cas order of expected/desired
2020-07-25 22:52:27 -07:00
daan
e27422adca
switch to using C++ atomics in MSVC as well
2020-07-25 20:55:45 -07:00
daan
70be91d6b8
reduce tsan warning by ensuring a require edge; issue #130
2020-07-22 15:28:14 -07:00
daan
8aa18d3661
fix TSAN warning for statistics maximum, issue #130
2020-07-22 14:16:18 -07:00
daan
2e1b4f512d
make max update in the stats atomic
2020-07-22 13:45:04 -07:00
daan
341048f61e
avoid atomic operations on statistics if zero
2020-07-22 11:08:16 -07:00
David Carlier
2254e20d4c
some apis are available on Illumos which are not available on stock Solaris
...
thus availability evelavated from cflags. discard some sporadically for large pages
support mainly.
2020-07-22 18:26:32 +01:00
Daan
532447fb33
Merge pull request #272 from devnexen/illumos_build
...
illumos support/build fix and large page support
2020-07-21 18:46:28 -07:00
Daan
e5ede9c723
Merge pull request #264 from DerVogel2020/dev
...
use stored pointer #257
2020-07-21 18:35:51 -07:00
Daan
56b58a8021
Merge pull request #267 from devnexen/haiku_support
...
haiku support.
2020-07-21 18:32:40 -07:00
daan
8769082d63
add pointer validity check in debug mode for mi_usable_size/mi_realloc/mi_expand. Issue #269
2020-07-20 14:33:03 -07:00
Daan
457fcbd9d5
Merge pull request #274 from Tyler-IN/agnostic-posix-musl-support
...
Posix / Musl Compatibility
2020-07-20 11:34:58 -07:00
daan
5f51c97fbd
override aligned_alloc always if using C compilation (issue #276 )
2020-07-20 11:27:42 -07:00
daan
892ec12611
Support Windows Vista and XP for NUMA aware alloction (issue #277 )
2020-07-20 11:10:45 -07:00
David Carlier
0c550d1626
illumos support/build fix and large page support
2020-07-10 03:26:14 +01:00
Tyler Young
b9a7f5cfae
fix mman.h ref
2020-07-09 10:58:47 -04:00
David Carlier
7e48eb033c
haiku support.
...
TLS unsupported thus disabled.
2020-06-28 13:53:45 +00:00
Wanja Vogel
2599512e8f
use stored pointer #257
2020-06-18 18:20:26 +02:00
daan
4ecce78d66
Merge branch 'master' into dev
2020-06-17 19:28:15 -07:00
daan
5a6d9ba807
fix handling of failing to allocate heap metadata on thread creation, issue #257
2020-06-17 19:07:32 -07:00
daan
32b3608581
simplify initial main tld declaration
2020-06-17 13:12:05 -07:00
Wanja Vogel
d5475a58a1
fix: avoid warning
...
warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).
2020-06-10 07:47:50 +02:00
Haneef Mubarak
429025634e
resolve #201 with a platform-selective REP MOVSB implementation
2020-05-26 16:04:28 -07:00
daan
66048cb6cc
fix return value for page_unreset
2020-05-19 13:31:24 -07:00
daan
6f73cc8b1d
Merge branch 'master' into dev
2020-05-19 10:41:08 -07:00
daan
a09a64e29b
add extra check in mi_page_unreset to not unreset for huge OS pages
2020-05-19 10:40:46 -07:00
Daan
0ed478089e
Merge pull request #242 from devnexen/ios_build_fix
...
IOS build fix, large pages unsupported.
2020-05-19 10:21:32 -07:00
daan
a7d2bc8ad6
edit warning messages to be more consistent
2020-05-19 10:16:28 -07:00
daan
74986c1dd1
weaken aligmenment assertion (issue #245 )
2020-05-19 09:56:37 -07:00
daan
a52b38342d
Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev
2020-05-19 09:55:08 -07:00
Daan Leijen
c9ffe30513
weaken alignment requirement to not need to be a multiple of sizeof(void*); see #246
2020-05-18 10:17:58 -07:00
Daan Leijen
bf6b781e40
fix semicolon ( #247 )
2020-05-18 10:08:18 -07:00
David Carlier
0ea4e3f279
IOS build fix, large pages unsupported.
2020-05-07 20:09:16 +01:00
daan
967513d536
add extra checks if unreset (commit) succeeds
2020-05-06 11:35:35 -07:00
daan
4f020e5da4
put a bound on the environment search
2020-05-05 20:19:20 -07:00
daan
45974efdb7
use environ on posix systems to read environment variables before the C runtime is initialized (issue #241 )
2020-05-05 19:37:50 -07:00
daan
29cb8f369a
slight cleanup of f10ba4fa, #239
2020-05-05 10:24:16 -07:00
Daan
f10ba4fa44
Merge pull request #239 from asl/oom-collect
...
In OOM case try to force collect memory and retry the allocation
2020-05-05 10:16:28 -07:00
daan
a278db940b
improve thread-id check for thread local FLS callbacks on Windows with static linking
2020-05-05 10:10:46 -07:00
daan
7c24edfeb0
add thread-id check for thread local FLS callbacks on Windows with static linking; found by @jasongibson
2020-05-04 14:31:32 -07:00
daan
9c0da9776d
fix assertion for huge block size
2020-05-03 11:43:57 -07:00
daan
097c007ba3
reduce page retire cycles based on object size
2020-05-02 00:19:20 -07:00
Daan
81bd1b70b0
Merge pull request #238 from asl/gcc-6-aligned-dealloc
...
Fix override condition for sized dealloc with gcc 6
2020-05-01 14:16:20 -07:00
daan
5cfdc39ff1
remove on-demand page commit option
2020-04-30 18:23:33 -07:00
daan
0af9dd6fd2
fix initialization of union padding; issue found through valgrind by @jasongibson
2020-04-30 17:40:00 -07:00
Anton Korobeynikov
fdd1cd821a
In OOM case try to force collect memory and retry the allocation.
2020-04-29 02:10:11 +03:00
daan
9a33f23b5f
fix MI_SHOW_ERRORS on msvc
2020-04-28 11:11:23 -07:00
daan
8f5710abcc
Merge branch 'master' into dev
2020-04-28 11:07:55 -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
0b440d9543
Apparently gcc 6 defines __cpp_aligned_new in C++14 mode, however no std::align_val_t is available there
...
for obvious reasons
2020-04-28 19:09:54 +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