mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
always use MI_HUGE_BLOCK_SIZE for pages in huge segments
This commit is contained in:
parent
4c6814bc68
commit
09f171b4f5
7 changed files with 72 additions and 25 deletions
|
@ -27,6 +27,7 @@ we therefore test the API over various inputs. Please add more tests :-)
|
|||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <vector>
|
||||
|
@ -59,6 +60,7 @@ bool mem_is_zero(uint8_t* p, size_t size) {
|
|||
// ---------------------------------------------------------------------------
|
||||
int main(void) {
|
||||
mi_option_disable(mi_option_verbose);
|
||||
mi_option_set(mi_option_remap_threshold, 100 /* in kib */);
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Malloc
|
||||
|
@ -284,6 +286,15 @@ int main(void) {
|
|||
mi_free(p);
|
||||
};
|
||||
|
||||
CHECK_BODY("reallo-huge") { // By Jason Gibson
|
||||
int* p = (int*)mi_malloc(356);
|
||||
p = (int*)mi_realloc(p, 583);
|
||||
memset(p, '\0', 580);
|
||||
p = (int*)mi_realloc(p, 1500705);
|
||||
p = (int*)mi_realloc(p, 3000711);
|
||||
mi_free(p);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------
|
||||
// Heaps
|
||||
// ---------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue