fix secure mode
This commit is contained in:
parent
93ae3e26b1
commit
c7ec30ae25
@ -29,7 +29,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||||||
// #define MI_SECURE 4 // experimental, may be more expensive: checks for double free.
|
// #define MI_SECURE 4 // experimental, may be more expensive: checks for double free.
|
||||||
|
|
||||||
#if !defined(MI_SECURE)
|
#if !defined(MI_SECURE)
|
||||||
#define MI_SECURE 4
|
#define MI_SECURE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Define MI_DEBUG for debug mode
|
// Define MI_DEBUG for debug mode
|
||||||
|
@ -226,12 +226,13 @@ uint8_t* _mi_segment_page_start(const mi_segment_t* segment, const mi_page_t* pa
|
|||||||
mi_assert_internal((uintptr_t)p % _mi_os_page_size() == 0);
|
mi_assert_internal((uintptr_t)p % _mi_os_page_size() == 0);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
/* TODO: guard pages between every slice span
|
||||||
if (MI_SECURE > 1 || (MI_SECURE == 1 && slice == &segment->slices[segment->slice_entries - 1])) {
|
if (MI_SECURE > 1 || (MI_SECURE == 1 && slice == &segment->slices[segment->slice_entries - 1])) {
|
||||||
// secure == 1: the last page has an os guard page at the end
|
// secure == 1: the last page has an os guard page at the end
|
||||||
// secure > 1: every page has an os guard page
|
// secure > 1: every page has an os guard page
|
||||||
psize -= _mi_os_page_size();
|
psize -= _mi_os_page_size();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (page_size != NULL) *page_size = psize;
|
if (page_size != NULL) *page_size = psize;
|
||||||
mi_assert_internal(_mi_ptr_page(p) == page);
|
mi_assert_internal(_mi_ptr_page(p) == page);
|
||||||
@ -708,6 +709,7 @@ static mi_page_t* mi_segments_page_alloc(mi_page_kind_t page_kind, size_t requir
|
|||||||
// find a free page
|
// find a free page
|
||||||
size_t page_size = _mi_align_up(required,(required > MI_MEDIUM_PAGE_SIZE ? MI_MEDIUM_PAGE_SIZE : MI_SEGMENT_SLICE_SIZE));
|
size_t page_size = _mi_align_up(required,(required > MI_MEDIUM_PAGE_SIZE ? MI_MEDIUM_PAGE_SIZE : MI_SEGMENT_SLICE_SIZE));
|
||||||
size_t slices_needed = page_size / MI_SEGMENT_SLICE_SIZE;
|
size_t slices_needed = page_size / MI_SEGMENT_SLICE_SIZE;
|
||||||
|
mi_assert_internal(slices_needed * MI_SEGMENT_SLICE_SIZE == page_size);
|
||||||
mi_page_t* page = mi_segments_page_find_and_allocate(slices_needed,tld); //(required <= MI_SMALL_SIZE_MAX ? 0 : slices_needed), tld);
|
mi_page_t* page = mi_segments_page_find_and_allocate(slices_needed,tld); //(required <= MI_SMALL_SIZE_MAX ? 0 : slices_needed), tld);
|
||||||
if (page==NULL) {
|
if (page==NULL) {
|
||||||
// no free page, allocate a new segment and try again
|
// no free page, allocate a new segment and try again
|
||||||
|
@ -17,7 +17,7 @@ terms of the MIT license.
|
|||||||
#include <mimalloc.h>
|
#include <mimalloc.h>
|
||||||
|
|
||||||
// argument defaults
|
// argument defaults
|
||||||
static int THREADS = 1; // more repeatable if THREADS <= #processors
|
static int THREADS = 32; // more repeatable if THREADS <= #processors
|
||||||
static int N = 20; // scaling factor
|
static int N = 20; // scaling factor
|
||||||
|
|
||||||
// static int THREADS = 8; // more repeatable if THREADS <= #processors
|
// static int THREADS = 8; // more repeatable if THREADS <= #processors
|
||||||
|
Loading…
Reference in New Issue
Block a user