Commit Graph

1159 Commits

Author SHA1 Message Date
Daan
1917fbd847
Merge pull request #467 from tiran/strict_prototypes
Fix strict function prototype warnings
2021-10-19 09:35:40 -07:00
Daan
d49b3a95a2
Merge pull request #464 from JJL772/master
Fix `_mi_error_message` printf formatting error
2021-10-19 09:28:20 -07:00
Christian Heimes
afbcf20f24 Define _DEFAULT_SOURCE for syscall and realpath
Define ``_DEFAULT_SOURCE`` in ``random.c`` and ``alloc.c``. The macro
is required for ``syscall()`` and ``realpath()``. Other files like
``os.c`` already define the macro.

Signed-off-by: Christian Heimes <christian@python.org>
2021-10-19 15:07:54 +02:00
Christian Heimes
7c73e3996d Fix strict function prototype warnings
Fix warning ``warning: function declaration isn’t a prototype`` when
building mimalloc with ``-Wstrict-prototypes`` flag. In C argumentless
functions should be declared as ``func(void)``.

Reproducer:
```shell
$ cmake ../.. -DCMAKE_C_FLAGS="-Wstrict-prototypes"
$ make VERBOSE=1
```

Co-authored-by: Sam Gross <colesbury@gmail.com>
Co-authored-by: Neil Schemenauer <nas@arctrix.com>
Signed-off-by: Christian Heimes <christian@python.org>
2021-10-19 10:48:26 +02:00
Daan Leijen
22c2fd82cc ensure managed os memory is at least one arena block in size 2021-10-18 20:44:19 -07:00
Daan Leijen
bcce4d52bf fix bug in determination of block size in pre-reserved arena memory 2021-10-18 20:39:39 -07:00
Daan
d6bbc08119 prefer monotonic clock for stats (issue #457) 2021-10-18 18:24:59 -07:00
Daan Leijen
6ef15943cc fix comments 2021-10-18 16:59:19 -07:00
Daan Leijen
8d2a21eb78 Merge branch 'dev' into dev-slice 2021-10-18 16:46:18 -07:00
Daan Leijen
bd8e3fd8e1 increase robustness of primitive windows allocation by always using a fallback to VirtualAlloc 2021-10-18 16:46:06 -07:00
Daan Leijen
54659aec9e merge from dev 2021-10-18 16:28:08 -07:00
Daan Leijen
0fb61c9eaa do not call exit if try handler fails but use abort instead 2021-10-18 16:25:10 -07:00
Thom Chiovoloni
3c058f07a9
Add an option to disable automatic use of getenv inside options.c 2021-10-08 23:59:35 -07:00
Jeremy Lorelli
c21b6df51e Fix missing parameter in mi_free error message 2021-10-05 08:41:03 -07:00
Daan Leijen
e6b58052da add start offset to pages to reduce cache/page effects 2021-10-02 11:13:00 -07:00
Daan Leijen
262022c1d1 fix segment map for 32-bit systems (including wasm) 2021-10-01 15:10:11 -07:00
Daan Leijen
d7ac4478a8 Merge branch 'dev' into dev-slice 2021-10-01 15:05:41 -07:00
Daan Leijen
679aad0659 update wasm support with emscripten compilation; now using sbrk instead of wasm_memory_grow 2021-10-01 15:05:01 -07:00
paulip1792
a2c3b0f8af add option to reserve huge os pages at a specific numa node. 2021-08-10 16:30:44 +08:00
bmalrat
ee0b01c84d Fixed stats in mi_os_mem_alloc_aligned on windows when re-allocate
In the last try the previous mi_os_mem_free decrease stat and mi_win_virtual_alloc doesn't increase it
2021-08-04 17:46:58 -04:00
bmalrat
30be78d97a Fixed typo in headers 2021-08-04 17:31:48 -04:00
Jim Huang
c4947c8879 Use secure random generator on macOS
The implementation of arc4random_buf differs from its documentation. It
is documented as "always successful, and no return value is reserved to
indicate an error" for the sake of FreeBSD compatibility [1]. However,
the actual implementation on macOS invokes function "ccrng_generate" [2]
without validating the error cases. It might fail silently[3], which leads
to unexpected source of entropy.

The original arc4random used the RC4 a.k.a. ARC4 algorithm, and ChaCha20
based implementation was introduced in FreeBSD 12.0. Since macOS 10.12,
it was replaced with the NIST-approved AES cipher, and it may be replaced
again in the future as cryptographic techniques advance. Therefore, we
should not assume that arc4random never fails.

On the contrary, CCRandomGenerateBytes(), part of Cryptographic Services [4],
returns cryptographically strong random bits with explicit status code.
This patch properly calls CCRandomGenerateBytes() and checks the status.

[1] https://www.freebsd.org/cgi/man.cgi?query=arc4random_buf
[2] https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60178.40.2/lib/CommonRandom.c.auto.html
[3] https://opensource.apple.com/source/Libc/Libc-1439.40.11/gen/FreeBSD/arc4random.c.auto.html
[4] https://developer.apple.com/documentation/security
2021-06-25 12:37:00 +08:00
hank
1c1571742d fix typo 2021-06-21 22:36:47 +08:00
David Carlier
a35a7d4f19 haiku biuld fix proposal, warning suppression. 2021-06-19 09:14:43 +00:00
Daan Leijen
b3b0fb5832 merge from dev 2021-06-17 20:05:40 -07:00
Daan Leijen
728be93977 fix for #414 making numa node count atomic 2021-06-17 19:38:51 -07:00
Daan Leijen
5869c85749 merge from dev 2021-06-17 19:18:57 -07:00
Daan Leijen
a83bca72b3 fixes for M1; disable interpose use zones; fix pedantic warnings 2021-06-17 19:15:09 -07:00
Daan Leijen
e592360d4d revert relative includes 2021-06-07 17:53:03 -07:00
Daan Leijen
6ba9387bf8 Merge branch 'dev' into dev-slice 2021-06-07 17:51:42 -07:00
Daan Leijen
c8b5b74500 improve warnings 2021-06-07 17:51:27 -07:00
Daan Leijen
d7eb0bab75 Merge branch 'dev' into dev-slice 2021-06-07 17:01:00 -07:00
Daan Leijen
bb957fcd81 Merge branch 'dev' of https://github.com/microsoft/mimalloc into dev 2021-06-07 17:00:35 -07:00
Daan
cd633b2e2a
Merge pull request #411 from jserv/predict-alloc_size
Add branch hint for _mi_os_good_alloc_size
2021-06-07 16:55:39 -07:00
Daan Leijen
9974b0ee23 Merge branch 'dev' into dev-slice 2021-06-07 16:51:14 -07:00
Daan Leijen
4ba32c3160 Revert "make all includes relative"
This reverts commit 1feb6123d9.
2021-06-07 16:47:57 -07:00
Daan Leijen
069b3276df merge from dev 2021-06-06 20:33:55 -07:00
Daan Leijen
7b595bd957 Merge branch 'dev' into dev-slice 2021-06-06 20:31:53 -07:00
Daan Leijen
1feb6123d9 make all includes relative 2021-06-06 20:31:36 -07:00
Jim Huang
d48c93af2c Add branch hint for _mi_os_good_alloc_size
In _mi_os_good_alloc_size, overflow caused by alignment size is rare,
and this patch added the appropriate branch hint during range checks.
2021-05-31 12:01:35 +08:00
Jim Huang
0f57425f80 Distinguish SI and Binary Prefixes
SI prefixes [the decimal prefixes] refer strictly to powers of 10. They
should not be used to indicate powers of 2. e.g., one kilobit
represents 1000 bits instead of 1024 bits. IEC 60027‐2 symbols are
formed adding a "i" to the SI symbol (e.g. G + i = Gi).
2021-05-30 20:13:28 +08:00
Daan Leijen
10ce8839fa merge from dev 2021-04-28 13:23:46 -07:00
Daan
16b3329bd4
Merge pull request #396 from jserv/fix-copyright-date
Bump copyright date
2021-04-28 13:11:11 -07:00
Daan Leijen
29ea7a89ab add braces 2021-04-28 13:08:59 -07:00
Daan
6d1658123c
Merge pull request #391 from jserv/improve-align-down
Rewrite align_down with bitwise operations
2021-04-28 13:07:13 -07:00
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
4e643b6d31 merge from dev 2021-02-24 15:53:26 -08: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
ad96d220f4 merge from dev 2021-02-24 15:17:35 -08:00
Daan Leijen
9317256a4f improved ASLR (issue #372) 2021-02-24 15:14:17 -08:00
Daan Leijen
47050371a1 fix issue #363 and disable assertion for now 2021-02-22 15:05:47 -08:00
Daan Leijen
8f69e7095d Merge branch 'dev' into dev-slice 2021-02-22 14:28:22 -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
ba84aa2783 Merge branch 'dev' into dev-slice 2021-02-01 15:47:37 -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
36b7a3cb03 merge from dev 2021-01-30 16:37:38 -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 Leijen
b93cba3b05 merge from dev 2021-01-29 16:53:52 -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
3bade4b1bd fix accounting of abandoned pages 2021-01-29 15:42:52 -08:00
Daan Leijen
542f577c81 Merge branch 'dev' into dev-slice 2021-01-29 15:23:36 -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
72559c5c49 merge from dev 2021-01-29 13:08:00 -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
e314699ee0 add debug view of arenas 2021-01-28 17:32:42 -08:00
Daan Leijen
217871cb45 fix search_idx start in managed arenas 2021-01-22 11:24:25 -08:00
Daan Leijen
3c70317393 merge from dev 2020-12-15 16:07:23 -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
Daan Leijen
b803095b83 merge from dev 2020-12-10 13:17:56 -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
unknown
ad05829195 remove shadow warning when building in static mode 2020-11-06 17:49:10 -08: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
10aca1cfb9 merge from dev 2020-10-15 20:01:38 -07: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
7e96634da4 merge from dev 2020-10-11 13:38:12 -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
e1c38eef76 use allow_decommit option for both the segment cache and pages 2020-09-24 17:20:39 -07:00
daan
b149099bf3 use relaxed load for last search position in an arena 2020-09-24 16:55:00 -07:00
daan
2822e5c1f3 Merge branch 'dev' into dev-slice 2020-09-24 16:33:22 -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
b59abce8ea Merge branch 'dev' into dev-slice 2020-09-24 10:16:54 -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
165b64f553 Merge branch 'dev-exp' into dev-slice 2020-09-24 09:11:58 -07:00
daan
c05302f097 Merge branch 'dev' into dev-exp 2020-09-24 09:11:49 -07:00
Daan Leijen
b1cc3d550c fix valid pointer detection on mac 2020-09-14 10:55:44 -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
fba65c440c merge from dev-exp 2020-09-14 09:05:16 -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
daan
01307a25ff fix assertion 2020-09-11 11:00:19 -07:00
daan
1d946146cc fix all_committed 2020-09-11 10:40:22 -07: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
fa01875eb2 merge from dev (with is_pinned/is_large separation) 2020-09-08 17:54:58 -07: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
d87933a3b5 update comments 2020-09-08 15:50:37 -07:00
daan
037285ac09 refactor segment cache and map in a separate source file 2020-09-08 13:27:34 -07:00
daan
161f9a7751 refactor arena allocation 2020-09-08 11:12:44 -07:00
daan
97629cefaa tune performance options with longer reset delay 2020-09-08 11:12:23 -07:00
daan
a948724340 merge from dev (bitmap split) 2020-09-08 10:33:30 -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
6b013d5f38 test for arena count early; skip test in bitmap_mask_ for perf 2020-09-07 22:55:36 -07:00
daan
371532ff02 merge from dev 2020-09-07 21:43:05 -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
313008ecaa ensure page->retire_expire is always 1 2020-09-07 15:20:59 -07:00
daan
3826132240 use dynamic initial commit 2020-09-06 14:51:20 -07:00
daan
b7046934e5 Merge branch 'dev' into dev-slice 2020-09-06 13:53:30 -07:00
daan
46ee8952eb update mi_process_info to not use doubles 2020-09-06 13:53:02 -07:00
daan
8c838a949f Merge branch 'dev' into dev-slice 2020-09-06 13:22:44 -07:00
daan
ee286919d9 add mi_process_info api call 2020-09-06 13:21:19 -07:00
daan
8e0d846b40 consistent commit order 2020-09-06 12:19:05 -07:00
daan
828613a694 use MADV_DONTNEED for commit/decommit on macOS 2020-09-06 12:06:56 -07:00
daan
5ae01fe4d9 experiment with commit strategy on macOS 2020-09-06 09:39:16 -07:00
daan
4f7bc7d98e Merge branch 'dev' into dev-slice 2020-09-06 08:50:44 -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
f9ca7cd05a use proper file descriptor in mmap for decommit 2020-09-05 22:16:58 -07:00
daan
1b571aea06 remove unused local warning 2020-09-05 22:03:47 -07:00
daan
f7dc4847f2 keep commit_mask live in the cache for better reuse 2020-09-05 21:58:32 -07:00
daan
63a9f45ba6 add initial mi_commit_mask abstraction 2020-09-05 19:39:10 -07:00
daan
36da7e91c5 Merge branch 'dev' into dev-slice 2020-09-05 18:17:22 -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
3d708aa7e1 fix warning in g++ 2020-09-05 12:16:46 -07:00
daan
5f31f5c2b9 Merge branch 'dev' into dev-slice 2020-09-05 12:05:00 -07:00
daan
9d82b15d87 fix warnings on vs2017 2020-09-05 12:04:25 -07:00
daan
4df01218e2 fix msvc compilation with new atomics 2020-09-05 10:03:37 -07:00
daan
644e453709 Merge branch 'dev' into dev-slice 2020-09-05 09:37:38 -07:00
daan
2e311f341b fix msvc compilation in C mode 2020-09-05 09:37:09 -07:00
daan
dc858f6d29 fix c++ compilation with new atomics for dev-slice 2020-09-05 09:23:22 -07:00
daan
7c2b79bef0 Merge branch 'dev' into dev-slice 2020-09-05 09:17:59 -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
97f56b1e08 merge from dev 2020-09-04 14:21:33 -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
b22401deb3 layout 2020-09-03 20:31:11 -07:00
daan
f6109765d8 update whitespace and comments 2020-09-03 15:04:40 -07:00
Daan Leijen
7058e501cb use atomic ops for the expire field; passes TSAN now 2020-09-03 13:53:56 -07:00
daan
228b5f6e9d use atomic load for segment map 2020-09-03 12:19:04 -07:00
daan
03071dec0f merge from dev-atomic with new atomic interface 2020-09-03 12:13:09 -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
daan
c1a834e886 add checks for when memory commit fails to return NULL 2020-08-28 10:40:46 -07:00
daan
e4ddc75069 set delayed decommit mask more precisely to only decommit currently committed blocks 2020-08-28 08:46:51 -07:00
daan
2cffc3b851 merge from dev 2020-08-27 22:43:57 -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
38c264ccdf merge from dev 2020-06-17 19:25:03 -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
cb05ef9f2c merge from dev 2020-05-19 10:43:46 -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
82e29f47b3 weaken assertion, #245 2020-05-18 18:51:06 -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
53aa46890a merge from dev 2020-05-05 10:54:59 -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
74ea69b784 increase default arena reset delay (behaves better on 36+ core systems) 2020-05-03 16:33:29 -07:00
daan
9c0da9776d fix assertion for huge block size 2020-05-03 11:43:57 -07:00