mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 07:29:30 +03:00
Merge branch 'dev' into dev-slice
This commit is contained in:
commit
2f8fb6aade
3 changed files with 33 additions and 5 deletions
|
@ -27,10 +27,10 @@ option(MI_DEBUG_TSAN "Build with thread sanitizer (needs clang)" OFF)
|
|||
option(MI_DEBUG_UBSAN "Build with undefined-behavior sanitizer (needs clang++)" OFF)
|
||||
option(MI_SKIP_COLLECT_ON_EXIT "Skip collecting memory on program exit" OFF)
|
||||
option(MI_NO_PADDING "Force no use of padding even in DEBUG mode etc." OFF)
|
||||
option(MI_INSTALL_TOPLEVEL "Install directly into $CMAKE_INSTALL_PREFIX instead of PREFIX/lib/mimalloc-version" OFF)
|
||||
|
||||
# deprecated options
|
||||
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
||||
option(MI_INSTALL_TOPLEVEL "Install directly into $CMAKE_INSTALL_PREFIX instead of PREFIX/lib/mimalloc-version (deprecated)" OFF)
|
||||
option(MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems) (deprecated and detected automatically)" OFF)
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
|
|
|
@ -40,4 +40,32 @@ if they are linked with the dynamic C runtime (`ucrtbase.dll`) -- just put the `
|
|||
into the import table (and put `mimalloc-redirect.dll` in the same folder)
|
||||
Such patching can be done for example with [CFF Explorer](https://ntcore.com/?page_id=388).
|
||||
|
||||
The `minject` program can also do this from the command line, use `minject --help` for options.
|
||||
The `minject` program can also do this from the command line, use `minject --help` for options:
|
||||
|
||||
```
|
||||
> minject --help
|
||||
|
||||
minject:
|
||||
Injects the mimalloc dll into the import table of a 64-bit executable,
|
||||
and/or ensures that it comes first in het import table.
|
||||
|
||||
usage:
|
||||
> minject [options] <exe>
|
||||
|
||||
options:
|
||||
-h --help show this help
|
||||
-v --verbose be verbose
|
||||
-l --list only list imported modules
|
||||
-i --inplace update the exe in-place (make sure there is a backup!)
|
||||
-f --force always overwrite without prompting
|
||||
--postfix=<p> use <p> as a postfix to the mimalloc dll (default is 'override')
|
||||
e.g. use --postfix=override-debug to link with mimalloc-override-debug.dll
|
||||
|
||||
notes:
|
||||
Without '--inplace' an injected <exe> is generated with the same name ending in '-mi'.
|
||||
Ensure 'mimalloc-redirect.dll' is in the same folder as the mimalloc dll.
|
||||
|
||||
examples:
|
||||
> minject --list myprogram.exe
|
||||
> minject --force --inplace myprogram.exe
|
||||
```
|
||||
|
|
|
@ -201,9 +201,9 @@ mi_heap_t* _mi_heap_main_get(void) {
|
|||
|
||||
// note: in x64 in release build `sizeof(mi_thread_data_t)` is under 4KiB (= OS page size).
|
||||
typedef struct mi_thread_data_s {
|
||||
mi_heap_t heap; // must come first due to cast in `_mi_heap_done`
|
||||
mi_heap_t heap; // must come first due to cast in `_mi_heap_done`
|
||||
mi_tld_t tld;
|
||||
mi_memid_t memid;
|
||||
mi_memid_t memid; // must come last due to zero'ing
|
||||
} mi_thread_data_t;
|
||||
|
||||
|
||||
|
@ -249,7 +249,7 @@ static mi_thread_data_t* mi_thread_data_zalloc(void) {
|
|||
}
|
||||
|
||||
if (td != NULL && !is_zero) {
|
||||
_mi_memzero_aligned(td, sizeof(*td));
|
||||
_mi_memzero_aligned(td, offsetof(mi_thread_data_t,memid));
|
||||
}
|
||||
return td;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue