mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 15:29:31 +03:00
fix warnings
This commit is contained in:
parent
8899a11c70
commit
f130808b5c
2 changed files with 7 additions and 8 deletions
10
src/alloc.c
10
src/alloc.c
|
@ -56,7 +56,7 @@ extern inline void* _mi_page_malloc_zero(mi_heap_t* heap, mi_page_t* page, size_
|
|||
if mi_unlikely(zero) {
|
||||
mi_assert_internal(page->block_size != 0); // do not call with zero'ing for huge blocks (see _mi_malloc_generic)
|
||||
mi_assert_internal(!mi_page_is_huge(page));
|
||||
#if MI_PADDING_SIZE > 0
|
||||
#if MI_PADDING
|
||||
mi_assert_internal(page->block_size >= MI_PADDING_SIZE);
|
||||
#endif
|
||||
if (page->free_is_zero) {
|
||||
|
@ -173,7 +173,7 @@ extern inline void* _mi_heap_malloc_zero_ex(mi_heap_t* heap, size_t size, bool z
|
|||
}
|
||||
#if MI_DEBUG_GUARDED
|
||||
else if ( huge_alignment == 0 && // guarded pages do not work with huge aligments at the moment
|
||||
_mi_option_get_fast(mi_option_debug_guarded_max) > 0 && // guarded must be enabled
|
||||
_mi_option_get_fast(mi_option_debug_guarded_max) > 0 && // guarded must be enabled
|
||||
((size >= (size_t)_mi_option_get_fast(mi_option_debug_guarded_min) && size <= (size_t)_mi_option_get_fast(mi_option_debug_guarded_max))
|
||||
|| ((mi_good_size(size) & (_mi_os_page_size()-1)) == 0)) ) // page-size multiple are always guarded so we can have a correct `mi_usable_size`.
|
||||
{
|
||||
|
@ -620,7 +620,7 @@ static mi_decl_restrict void* mi_heap_malloc_guarded(mi_heap_t* heap, size_t siz
|
|||
mi_assert_internal(_mi_is_aligned(guard_page, os_page_size));
|
||||
|
||||
// place block in front of the guard page
|
||||
size_t offset = block_size - os_page_size - obj_size;
|
||||
size_t offset = block_size - os_page_size - obj_size;
|
||||
if (offset > MI_BLOCK_ALIGNMENT_MAX) {
|
||||
// give up to place it right in front of the guard page if the offset is too large for unalignment
|
||||
offset = MI_BLOCK_ALIGNMENT_MAX;
|
||||
|
@ -629,8 +629,8 @@ static mi_decl_restrict void* mi_heap_malloc_guarded(mi_heap_t* heap, size_t siz
|
|||
mi_assert_internal(p>=block);
|
||||
|
||||
// set page flags
|
||||
if (offset > 0) {
|
||||
mi_page_set_has_aligned(page, true);
|
||||
if (offset > 0) {
|
||||
mi_page_set_has_aligned(page, true);
|
||||
}
|
||||
|
||||
// set guard page
|
||||
|
|
|
@ -452,14 +452,14 @@ static size_t mi_segment_calculate_sizes(size_t capacity, size_t required, size_
|
|||
size_t guardsize = 0;
|
||||
size_t isize = 0;
|
||||
|
||||
|
||||
|
||||
if (MI_SECURE == 0) {
|
||||
// normally no guard pages
|
||||
#if MI_DEBUG_GUARDED
|
||||
isize = _mi_align_up(minsize, _mi_os_page_size());
|
||||
#else
|
||||
isize = _mi_align_up(minsize, 16 * MI_MAX_ALIGN_SIZE);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
// in secure mode, we set up a protected page in between the segment info
|
||||
|
@ -745,7 +745,6 @@ static void mi_segment_page_clear(mi_segment_t* segment, mi_page_t* page, mi_seg
|
|||
void _mi_segment_page_free(mi_page_t* page, bool force, mi_segments_tld_t* tld)
|
||||
{
|
||||
mi_assert(page != NULL);
|
||||
mi_assert_internal(!mi_page_has_guarded(page));
|
||||
mi_segment_t* segment = _mi_page_segment(page);
|
||||
mi_assert_expensive(mi_segment_is_valid(segment,tld));
|
||||
mi_pages_try_purge(false /*force?*/, tld);
|
||||
|
|
Loading…
Add table
Reference in a new issue