mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
set extra debug padding per-heap
This commit is contained in:
parent
ae608cda2f
commit
9ebb94fe17
10 changed files with 65 additions and 49 deletions
|
@ -16,7 +16,7 @@ static void dangling_ptr_write();
|
|||
|
||||
int main() {
|
||||
mi_version();
|
||||
|
||||
mi_heap_set_extra_padding(mi_heap_get_default(), 200);
|
||||
// detect double frees and heap corruption
|
||||
// double_free1();
|
||||
// double_free2();
|
||||
|
|
|
@ -153,7 +153,10 @@ int main() {
|
|||
result = ok;
|
||||
});
|
||||
CHECK_BODY("malloc-aligned5", {
|
||||
void* p = mi_malloc_aligned(4097,4096); size_t usable = mi_usable_size(p); result = usable >= 4097 && usable < 10000; mi_free(p);
|
||||
void* p = mi_malloc_aligned(4097,4096);
|
||||
size_t usable = mi_usable_size(p);
|
||||
result = (usable >= 4097 && usable < 12000 && ((uintptr_t)p % 4096) == 0);
|
||||
mi_free(p);
|
||||
});
|
||||
CHECK_BODY("malloc-aligned-at1", {
|
||||
void* p = mi_malloc_aligned_at(48,32,0); result = (p != NULL && ((uintptr_t)(p) + 0) % 32 == 0); mi_free(p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue