Jim Huang
c382c72cf2
Avoid using strlen function in loop
2019-07-21 22:30:42 +08:00
Jim Huang
1ffa48cc61
Add branch prediction hint for mi_option_get
...
mi_option_get is called frequently in stress tests, and the patch adds
extra hint to the compiler to emit instructions that will cause branch
prediction to favour the "likely" side of a jump instruction.
2019-07-21 21:42:00 +08:00
daan
f0de0b6f68
remove old windows override code
2019-07-19 09:33:14 -07:00
daan
2ac2c6a1c3
fix format of error messages
2019-07-19 09:27:32 -07:00
daan
fcd0253ac9
limit number of error messages to 10
2019-07-19 09:27:14 -07:00
daan
dd5fa88c45
check better for valid pointers in free in debug mode
2019-07-19 09:26:51 -07:00
caixiangyue
a215049b4a
fix typo
2019-07-19 16:23:14 +08:00
daan
fd6fd23470
make eager-region-commit false by default on windows
2019-07-18 21:48:58 -07:00
daan
8dad858888
update to correct project settings for visual studio
2019-07-18 21:41:28 -07:00
daan
93c8a5b693
full overriding api supported
2019-07-18 21:12:40 -07:00
daan
306a542336
add mimalloc-override header file and use C++ compilation with msvc
2019-07-18 20:28:29 -07:00
daan
12e0a04052
compile as C++ under msvc
2019-07-18 19:52:29 -07:00
daan
c228ecefd8
update for new dynamic direction on windows 64-bit
2019-07-18 18:59:32 -07:00
daan
f646cc925d
add is_in_heap_region function
2019-07-17 15:37:36 -07:00
daan
7b5ba96e8e
merge from dev
2019-07-15 18:58:04 -07:00
daan
72d8608333
avoid thread over-allocation on initial region allocations
2019-07-15 17:35:43 -07:00
daan
7ea9cf8d1f
add region collection
2019-07-15 14:53:03 -07:00
daan
89bdcd43b2
fix bit search index
2019-07-15 14:33:15 -07:00
daan
08e0f14c2a
document experimental options
2019-07-15 14:32:54 -07:00
daan
ea9dbd1036
set better default options for performance
2019-07-15 13:19:26 -07:00
daan
0196622fff
Merge branch 'dev' into dev-exp
2019-07-15 11:10:12 -07:00
Daan
ad45dbf0e5
Merge pull request #32 from jedisct1/wasm
...
Port to WebAssembly
2019-07-15 11:03:46 -07:00
Daan
60e9d3f69d
Merge pull request #81 from devnexen/mac_large_page_2mb
...
initial support of 2MB pages on Mac
2019-07-15 10:56:53 -07:00
daan
bd6abd2463
add comment about large pages
2019-07-15 10:07:23 -07:00
daan
76a5adfbfe
Merge branch 'dev' into dev-win
2019-07-15 10:04:55 -07:00
daan
d706109b35
don't decommit/reset parts of a region when using large os pages
2019-07-15 10:04:43 -07:00
daan
beef7a8c70
Merge branch 'dev' into dev-exp
2019-07-15 09:47:09 -07:00
daan
7ba6192dd5
always pass commit flag to large page allocation on windows
2019-07-15 09:46:58 -07:00
daan
08c873c250
Merge branch 'dev' into dev-exp
2019-07-14 20:35:01 -07:00
daan
4e855988b4
Merge branch 'dev' into dev-win
2019-07-14 20:34:05 -07:00
daan
c4426e1555
add sized delete to windows override
2019-07-14 20:28:33 -07:00
daan
461b8aed80
more complete C++ support for compliance and performance
2019-07-14 19:56:33 -07:00
Frank Denis
9129ab0f64
Port to WebAssembly
2019-07-15 02:22:41 +02:00
daan
8dc0b5345b
Merge branch 'dev' into dev-exp
2019-07-14 16:50:38 -07:00
daan
c5da02788f
Merge branch 'dev' into dev-win
2019-07-14 16:50:18 -07:00
daan
49ceb4d018
refactor delayed_free code
2019-07-14 16:48:53 -07:00
daan
5ad2effb39
use standard compliant compilation of the thread_free atomic field
2019-07-14 16:20:27 -07:00
daan
2cf419c9bc
Merge branch 'master' into dev
2019-07-14 14:50:39 -07:00
daan
adf65a100e
be less aggressive in page reuse to reduce memory footprint
2019-07-14 14:13:47 -07:00
daan
672506a3b3
merged with dev-win
2019-07-14 12:57:47 -07:00
daan
f93a49446f
Merge branch 'dev' into dev-win
2019-07-14 12:55:52 -07:00
daan
e60a5db908
fix cache eviction of smaller segments
2019-07-14 12:52:58 -07:00
daan
89b7ffa8ed
link DiscardVirtualMemory dynamically as it is not supported on every windows
2019-07-13 08:12:16 -07:00
daan
84a292538c
merge with medium pages
2019-07-12 20:39:29 -07:00
daan
a927c07de9
merge medium pages
2019-07-12 20:27:56 -07:00
daan
42cf5e1580
reintroduce support for medium size pages
2019-07-12 20:11:39 -07:00
linkwk7
d4eabf33b6
Fix typo in comments
2019-07-12 22:05:07 +08:00
daan
8a6b474fa0
merge from dev
2019-07-11 16:32:11 -07:00
daan
a932e43650
experiment with larger small pages
2019-07-11 15:44:37 -07:00
daan
9e9208eae8
Merge branch 'dev' into dev-win
2019-07-11 15:22:09 -07:00
daan
1fdb4b288f
more eager handling of non-local frees
2019-07-11 15:21:57 -07:00
daan
1377b26b0a
Merge branch 'dev' into dev-win
2019-07-11 13:31:02 -07:00
daan
72a39c0bb1
initial fix for delayed freeing of huge pages transferred between threads
2019-07-11 13:30:40 -07:00
daan
f844665c9f
merge from dev-win
2019-07-10 22:57:37 -07:00
daan
c555e09504
Merge branch 'dev' into dev-win
2019-07-10 22:48:20 -07:00
daan
da0fb1e53f
merge dev-win
2019-07-10 20:50:32 -07:00
daan
6deea16d2d
add segment count to internal statistics
2019-07-10 19:54:46 -07:00
daan
ef4359b272
fix abondoned segment counter, and free list adding
2019-07-10 16:33:49 -07:00
daan
b80b0837ab
Merge branch 'dev-win' into dev-exp
2019-07-10 07:50:26 -07:00
daan
5b6f4ecc12
fix compilation warning
2019-07-10 07:50:04 -07:00
daan
224951695a
enable non eager commit
2019-07-10 07:24:56 -07:00
daan
46a9e51f74
enable non eager-commit flag
2019-07-10 07:17:21 -07:00
daan
a6c5e2cffd
Merge branch 'master' into dev
2019-07-09 23:49:29 -07:00
daan
95afe453f4
fix compilation warning on windows, issue #94
2019-07-09 23:49:12 -07:00
daan
d8c47bfed2
ensure commit of reused cached segments
2019-07-09 23:37:59 -07:00
daan
3192ca4682
merge with dev-win
2019-07-09 23:34:17 -07:00
daan
3009a7b1fe
support non- eager_commit; on larson reduces commit charge 10x, but other benchmarks often see no improvement
2019-07-09 21:34:56 -07:00
daan
2ef1f1df94
Merge branch 'dev' into dev-win
2019-07-09 21:05:30 -07:00
daan
09195b6a5f
add commit charge statistics on windows
2019-07-09 21:05:09 -07:00
daan
873d07d89d
merge with dev
2019-07-09 20:44:58 -07:00
daan
ad9db3a633
fix leak of huge segments in caches
2019-07-09 20:35:07 -07:00
daan
ee3f2059dc
fix leak in segment cache freeing
2019-07-09 20:32:54 -07:00
daan
0314373d93
add reset_decommit, reset_discard options; maintain more statistics
2019-07-09 20:24:00 -07:00
daan
2cfdbc2cbb
fix leak in segment cache freeing
2019-07-09 20:22:53 -07:00
daan
129149977d
Merge branch 'dev' into dev-exp
2019-07-08 17:45:04 -07:00
daan
76023ca45f
fix path max in realpath on unix (pr #69 )
2019-07-08 17:43:10 -07:00
daan
8203f3dcfa
add full heap aligned allocation api (issue #52 ); remove rezalloc (issue #63 ); add mi_version
2019-07-08 17:17:07 -07:00
daan
4d22ff6d03
Merge branch 'dev' into dev-exp
2019-07-08 15:45:50 -07:00
daan
d656f3e339
merge with master
2019-07-08 15:45:37 -07:00
daan
493dfc4b82
merge with dev
2019-07-08 15:42:42 -07:00
daan
56bdb2c2f3
add more const declarations (pr #79 )
2019-07-08 12:00:59 -07:00
daan
7f0137a617
Fix compilation error with MSVC C++
2019-07-07 21:59:53 -07:00
daan
7e743dfb58
fix C++ compilation warnings with VisualStudio 2017
2019-07-07 18:52:12 -07:00
daan
c3528203b5
fix compilation with C++, fix overrides in C++ to adhere to the spec (issue #26 )
2019-07-07 18:11:21 -07:00
daan
dd59a917ce
Expose mi prefixed public standard implementations of various posix, unix, and c++ allocation functions. See issue #75
2019-07-07 13:44:33 -07:00
David Carlier
a192d6893e
initial support of 2MB pages on Mac
2019-07-05 20:05:04 +01:00
daan
b40fe5178a
fix static object linking
2019-07-04 14:56:58 -07:00
daan
983c96a238
Merge branch 'dev' into dev-exp
2019-07-04 14:46:53 -07:00
daan
5ff037f8f8
add capability to override multiple entry points in windows dynamic override; and stop patching msvcrt, just crtbase
2019-07-04 12:06:15 -07:00
daan
74dc95c1d6
fix crash triggered in release mode with windows dynamic overriding
2019-07-04 12:04:56 -07:00
daan
3039dbfcdd
for windows dynamic override, add standard api override and stop patching new/delete (for now)
2019-07-04 09:29:33 -07:00
daan
6abdc5f5a3
do not enable verbose by default in the debug build; add trace messages for verbose level 2
2019-07-04 09:28:22 -07:00
daan
069208b184
Possible fix to windows dynamic override calling register onexit directly
2019-07-03 19:47:44 -07:00
daan
663769c512
merge dev branch
2019-07-03 18:12:55 -07:00
Ernesto Castellotti
8c2f52dee8
Suppressed the new GCC 9 -Wmissing-attributes warnings
...
With the new release of the GCC 9 compiler the operation of -Wmissing-attributes warnings has also been extended to aliases: this causes a warnings if the alias has less attributes than its target.
This warnings does not actually indicate a problem in the mimalloc code and you could safely ignore it by adding "-Wno-missing-attributes" to the CFLAGS, however I was not going to use a "hack" to hide the warning when compiling alloc-override .c
So this patch solves the problem simply by using an attribute (present only in GCC> = 9) that copies the attributes of another function, since this attribute is exclusive only for GCC 9 (or later) I had to use a simple precompiler instruction to add the "copy" attribute only with GCC 9.
2019-07-04 00:21:15 +02:00
daan
c3a5f84ad3
rewrite of low-level OS (aligned) allocation to better handle large pages and aligned allocation
2019-07-03 14:52:32 -07:00
daan
7b4f3591f0
fix dynamic override when both msvcrt and ucrtbase are loaded in any order using priorities
2019-07-03 14:23:30 -07:00
daan
9390642879
fix windows dynamic malloc overried when both ucrtbase and msvcrt are loaded; also fix virtualalloc2 on 32-bit
2019-07-03 13:00:43 -07:00
daan
158705815e
fix aligned_ensured bug, trie inc bug, stats in the OS module
2019-07-03 00:16:27 -07:00
daan
10a29f17c8
more conservative shrinking of memory
2019-07-02 22:49:12 -07:00
daan
cec3c4f9ff
merge in dev branch
2019-07-02 17:28:15 -07:00
daan
5c0ffe9865
merge back changes to OS module from 'dev-exp'
2019-07-02 17:17:03 -07:00
daan
8cb36c62e6
merge with dev branch
2019-07-02 16:44:35 -07:00
daan
42efe51184
Merge branch 'master' into dev
2019-07-02 16:22:55 -07:00
Daan
f06931ba7e
Merge pull request #65 from devnexen/mi_mmap_prot_max_support
...
Using BSD new PROT_MAX mmap to block page address wider promotions
2019-07-02 16:21:13 -07:00
daan
b0ceb4a44c
forward strdup, strndup, and realpath too
2019-07-02 15:56:01 -07:00
daan
b3f533167b
Merge branch 'master' into dev
2019-07-02 15:52:26 -07:00
daan
7dc3a5a18e
Merge branch 'master' into dev
2019-07-02 15:44:48 -07:00
daan
04b1fd7b8d
Fix macro spelling
2019-07-02 12:57:12 -07:00
daan
4326bda2c7
Fix main heap cookie on macOS
2019-07-02 12:53:53 -07:00
daan
aeff1db32b
Fixing interpose on macOS
2019-07-02 12:49:28 -07:00
Daan
825d00a001
Merge branch 'master' into indent-override
2019-07-02 09:03:32 -07:00
daan
d35fc6cdc4
PR#66 by kickunderscore to ensure consistent small block alignment
2019-07-02 08:46:50 -07:00
daan
06bcea1761
Initial commit of separate memory region layer and improved large OS pages support, see 'memory.c'
2019-07-02 07:23:24 -07:00
David Carlier
bed746d7d6
Using BSD new PROT_MAX mmap to block page address wider promotions
2019-07-01 06:56:16 +00:00
Jim Huang
2347a65fe0
Clarify the comment about Linux distributions
...
Red Hat Linux was discontinued by Red Hat in 2003. It would make sense
to address glibc-based Linux distributions rather than Red Hat Linux.
Reference: https://en.wikipedia.org/wiki/Red_Hat_Linux
2019-06-30 01:17:13 +08:00
Jim Huang
329a494783
Make forwarding macros friendly to indentation or style checkers
...
Indention programs such as clang-format usually rely on the occurrence
of statement terminator, otherwise they are likely confused. The revised
forwarding macros do not contain semicolons character, which is friendly
to indentation or style checkers.
2019-06-30 01:06:13 +08:00
daan
d6901558cd
enable large OS page support on Windows
2019-06-28 22:35:57 -07:00
daan
6eaf387891
Add support for aligned allocation on Windows using VirtualAlloc2
2019-06-28 19:48:30 -07:00
daan
d2a2508af3
fix overly restrictive assertion
2019-06-27 13:34:14 -07:00
daan
1e636c45da
add check for overflowing size allocation
2019-06-27 13:33:28 -07:00
daan
12d756e7b2
fix page count of heap when absorbing
2019-06-27 13:32:44 -07:00
daan
36826a96c9
add power-of-two check to posix_memalign, pr #56
2019-06-27 13:29:00 -07:00
daan
ec2a8f387b
strengthen alignment check to be void* aligned
2019-06-27 13:27:53 -07:00
daan
b3ce61c408
fix atomic statistics counter increase
2019-06-25 20:05:43 -07:00
daan
654bcd7049
Merge branch 'master' into dev
2019-06-25 19:57:45 -07:00
Daan
1713c37f9d
Merge pull request #28 from jserv/gcc-visibility
...
Avoid unnecessary symbol exposure with ELF-based systems
2019-06-25 19:54:28 -07:00
daan
cae02b4676
Merge branch 'master' into dev
2019-06-25 19:45:59 -07:00
Jim Huang
47e822c70f
Correct the use of MI_DEBUG by conditional build
...
MI_DEBUG is a macro rather than a variable.
2019-06-25 21:59:20 +08:00
Frank Denis
59a714725b
Read-only strings should be const char *
2019-06-25 12:19:36 +02:00
Frank Denis
236cd2e65c
fn() is not a valid C prototype
2019-06-25 12:16:36 +02:00
Jim Huang
256eb97849
Avoid unnecessary symbol exposure with ELF-based systems
...
GCC's default visibility is "public" but can be changed to
"hidden" with the argument "-fvisibility=hidden".
Tested with x86_64 / Ubuntu Linux 18.04 LTS:
[before]
$ nm -g -C libmimalloc.so | grep "T " | wc -l
142
[after]
$ nm -g -C libmimalloc.so | grep "T " | wc -l
93
This patch does not change the build on macOS.
2019-06-25 10:00:22 +08:00
daan
c1226611c6
Merge branch 'master' into dev
2019-06-24 18:13:04 -07:00
Daan
8bb8852d4f
Merge pull request #17 from jserv/macos-rebranding
...
Apple rebrands "OS X" as "macOS"
2019-06-24 18:12:06 -07:00
Daan
e86935e108
Merge pull request #18 from jserv/fix-typo
...
Fix typo
2019-06-24 18:09:26 -07:00
daan
cc951affac
fix compilation on older mac systems without CLOCK_MONOTONIC
2019-06-24 18:06:46 -07:00
daan
f36149a9ac
fix format specifiers
2019-06-24 12:20:32 -07:00
Jim Huang
855e2f0d89
Use clock_gettime() instead of timespec_get()
...
clock_gettime(CLOCK_REALTIME, &ts) is equivalent to timespec_get(&ts,
TIME_UTC) in C11.
It has the advantage that avoids the following building error when building
with macOS:
warning: 'timespec_get' is only available on macOS 10.15 or newer
[-Wunguarded-availability-new]
2019-06-24 23:56:19 +08:00
daan
cbbd57322a
Merge branch 'master' into dev
2019-06-24 08:12:25 -07:00
daan
91222691cb
fix more warnings on mingw build
2019-06-24 00:42:45 -07:00
daan
c1c848516c
fix warnings on mingw build
2019-06-24 00:37:15 -07:00
daan
faadceadf5
Merge branch 'master' into dev
2019-06-24 00:21:07 -07:00
daan
443fa0fbb5
fix assertions for the new huge page cache
2019-06-24 00:06:22 -07:00
daan
f0731862d6
fix compilation on mingw, issue #25
2019-06-23 23:17:44 -07:00
daan
cd7aa0ce83
improve handling of huge pages in the cache
2019-06-23 23:15:42 -07:00
daan
43568fa422
ensure huge pages are part of the segment cache to avoid mmap calls
2019-06-23 21:37:43 -07:00
daan
e5e2b789ba
fix pool commit for windows
2019-06-23 20:41:34 -07:00
Jim Huang
a667971cbf
Apple rebrands "OS X" as "macOS"
...
In 2012, with the release of OS X 10.8 Mountain Lion, the name of the
system was shortened from Mac OS X to OS X. In 2016, with the release
of macOS 10.12 Sierra, the name was changed from OS X to macOS to
streamline it with the branding of Apple's other primary operating
systems: iOS, watchOS, and tvOS.
Reference: https://en.wikipedia.org/wiki/MacOS
2019-06-24 10:15:50 +08:00
Jim Huang
243636b6a1
Fix typo in comment
2019-06-24 10:13:43 +08:00
daan
3526b09903
fix gcc warning
2019-06-23 18:37:54 -07:00
Daan Leijen
ef02104fd3
fix posix_memalign according to issue #27
2019-06-23 10:59:47 -07:00
Daan
fab7329c7a
Merge pull request #24 from jserv/clarify-license
...
Clarify top-level license file
2019-06-23 10:47:38 -07:00
Jim Huang
78c7a1f349
Fix typo in comments
2019-06-24 01:40:28 +08:00
Jim Huang
b1d299b35b
Clarify top-level license file
...
To be consistent with other Microsoft open source projects, each source
file points to the file "LICENSE" in top-level directory.
2019-06-23 19:53:34 +08:00
Daan
06f8da4218
Merge pull request #15 from krytarowski/netbsd-1
...
Fix build on NetBSD
2019-06-22 21:04:15 -07:00
Kamil Rytarowski
b0b1b43dba
Fix build on NetBSD
...
Add missing argument in mi_mmap()
2019-06-23 00:06:41 +02:00
Frank Denis
4d67e58e0f
Fix mi_process_info placeholder prototype
2019-06-22 22:43:14 +02:00
Sungmann Cho
def97b0fd1
Fix spelling errors
...
aligment -> alignment
purgable -> purgeable
thead -> thread
2019-06-23 00:09:11 +09:00
daan
26a874eb3f
initial checkin
2019-06-19 16:26:12 -07:00