Commit Graph

100 Commits

Author SHA1 Message Date
Anton Korobeynikov
39bcf8a6b0 Honour MI_STAT in couple more places. 2020-11-02 00:14:02 +03:00
daan
14b8d27386 track pinned memory separately from large os pages 2020-09-08 16:46:03 -07:00
daan
2e311f341b fix msvc compilation in C mode 2020-09-05 09:37:09 -07:00
daan
900c97664a merge from dev-atomic 2020-09-03 09:47:01 -07:00
daan
8033b62979 allow overriding MI_MAX_ALIGN_SIZE 2020-08-29 09:59:15 -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
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
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
daan
69a0846478 add MI_PADDING flag to cmake to supress use of padding in debug mode 2020-04-07 10:01:18 -07:00
daan
7745dde8d2 allow retirement for all object sizes (issue #212) 2020-03-16 15:31:37 -07:00
daan
8a2a52843d delete all thread owned heaps when a thread is terminated (issue #202) 2020-02-13 12:15:23 -08:00
daan
aa68b8cbc7 improve encoding of padding canary and buffer overflow detection 2020-02-01 12:16:37 -08:00
daan
40f1e1e07b byte-precise heap block overflow checking with encoded padding 2020-01-31 23:39:51 -08:00
daan
68112a2751 better padding implementation, more precise statistics 2020-01-31 20:34:24 -08:00
daan
4531367de2 fix padding check for aligned allocation; improve perf for small aligned allocations 2020-01-31 13:20:02 -08:00
daan
5d212d688f add MI_PADDING build option to add padding to each block to detect heap block overflows 2020-01-29 17:10:57 -08:00
daan
5e32d00aab add visit count to abandoned to limit list length 2020-01-25 12:26:08 -08:00
daan
7a1e86fc20 merge from dev 2020-01-15 18:03:37 -08:00
daan
0099707af9 use delayed free for all pages; reduce size of the page structure for improved address calculation 2020-01-15 17:19:01 -08:00
daan
c9b5ac80b3 update page reset queue to just do delayed page resets 2020-01-15 12:00:44 -08:00
daan
941c55ee42 wip: first implementation of page free list on segments for effecient delayed page reset 2020-01-14 21:47:18 -08:00
daan
683d8998d4 fix potential A-B-A problem with segment abandonment; noticed by Manual Poeter and Sam Gross 2020-01-08 17:45:38 -08:00
daan
eeb623e6af increase retire limit, collect retired pages 2020-01-03 17:06:41 -08:00
daan
f9ca88f71c set secure default to 0 again 2020-01-02 17:57:41 -08:00
daan
fc3e537bd4 improve double free detection with faster same page check 2019-12-28 15:28:13 -08:00
daan
e3391d9a53 stronger encoding of free lists using two keys per page 2019-12-28 00:57:42 -08:00
daan
ba87a39d9f updated random cookie generation using OS primitives and chacha20 2019-12-22 19:37:49 -08:00
daan
50575b12c0 Merge branch 'dev' into dev-exp 2019-11-21 16:29:59 -08:00
daan
41caf6d0f8 set secure default to 0 2019-11-21 16:29:46 -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
211f1aa519 remove reset delay slots; add reset tracking per page and segment 2019-11-20 14:55:12 -08:00
daan
a0958b2da6 enable more reset delay slots 2019-11-11 17:06:16 -08:00
daan
181bef382c merge dev-exp 2019-11-10 11:39:53 -08:00
daan
27f1a8b3d2 fix avg display; set secure default to 0` 2019-11-07 10:35:30 -08:00
daan
36090dee5c Merge branch 'dev' into dev-exp 2019-11-07 10:34:06 -08:00
daan
31d11f64d5 fix secure free list extension where a non-empty initial free list was discarded 2019-11-07 10:33:45 -08:00
daan
378716c467 refactor and improve atomic bitmap usage 2019-11-07 10:26:52 -08:00
daan
829fd872f4 initial delay slots 2019-11-04 11:48:41 -08:00
daan
fd9d8c85ae change numa support on linux to use getcpu 2019-11-02 11:55:03 -07:00
daan
2c12d7f223 optimized numa calls; better Linux support 2019-11-01 22:01:52 -07:00
daan
b052d3b731 enable double free and heap corruption detection in debug mode 2019-10-28 15:54:33 -07:00
daan
081e2d1eb6 fix statistics display 2019-10-28 13:43:42 -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
5de851a84d update page_flags to have more portable definition 2019-10-17 16:48:16 -07:00
daan
26c27fbf58 use uint8_t bit fields, and improve portability of page_flags type 2019-10-17 12:07:26 -07:00
Johannes Schindelin
559688ec64 Suppress warning about unnamed struct
This prevents MSVC complaining with

	warning C4201: nonstandard extension used: nameless struct/union

The struct might seem unnecessary to the occasional reader (it did seem
so to this commit's author), but it is not! It is required to align the
fields to a boundary, which is verified by the test suite. Removing that
"unnecessary" `struct` results in this failure:

1: Test command: mimalloc-test-api
[...]
1: test: malloc-zero...  mimalloc: assertion failed: at src/page.c:591, mi_page_init
1:   assertion: "!mi_page_has_aligned(page)"

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-10-17 20:43:18 +02:00
Johannes Schindelin
e747a6f3a6 Use unsigned for bit-field variables
It is actually non-standard to use `bool` with a bit-field quantifier,
and VS 2019 complains about this.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-10-17 20:43:18 +02:00
Daan Leijen
1909cfb346 refine mi_os_good_alloc_size and use it for huge pages (to ensure realloc is bounded as in #153 2019-09-10 13:26:51 -07:00