mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-07 03:48:42 +03:00
add initial support for using mimalloc with address sanitizer support; use -DMI_ASAN=ON
This commit is contained in:
parent
76db72814c
commit
10981ab122
5 changed files with 47 additions and 4 deletions
|
@ -80,7 +80,7 @@ static mi_decl_noinline void* mi_heap_malloc_zero_aligned_at_fallback(mi_heap_t*
|
|||
|
||||
#if MI_TRACK_ENABLED
|
||||
if (p != aligned_p) {
|
||||
mi_track_free(p);
|
||||
mi_track_free_size(p, oversize);
|
||||
mi_track_malloc(aligned_p, size, zero);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -697,7 +697,7 @@ void* _mi_heap_realloc_zero(mi_heap_t* heap, void* p, size_t newsize, bool zero)
|
|||
const size_t size = _mi_usable_size(p,"mi_realloc"); // also works if p == NULL (with size 0)
|
||||
if mi_unlikely(newsize <= size && newsize >= (size / 2) && newsize > 0) { // note: newsize must be > 0 or otherwise we return NULL for realloc(NULL,0)
|
||||
// todo: adjust potential padding to reflect the new size?
|
||||
mi_track_free(p);
|
||||
mi_track_free_size(p, size);
|
||||
mi_track_malloc(p,newsize,true);
|
||||
return p; // reallocation still fits and not more than 50% waste
|
||||
}
|
||||
|
|
|
@ -558,6 +558,7 @@ void mi_process_init(void) mi_attr_noexcept {
|
|||
_mi_verbose_message("debug level : %d\n", MI_DEBUG);
|
||||
#endif
|
||||
_mi_verbose_message("secure level: %d\n", MI_SECURE);
|
||||
_mi_verbose_message("mem tracking: %s\n", MI_TRACK_TOOL);
|
||||
mi_thread_init();
|
||||
|
||||
#if defined(_WIN32) && !defined(MI_SHARED_LIB)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue