stronger secure mode when defining MI_SECURE=4: checks for double free, corrupted free list, and invalid pointer frees. Performance is impacted but not too much -- more perf testing is needed

This commit is contained in:
daan 2019-10-18 18:11:04 -07:00
parent fdfa6ed260
commit 2affdbbd2e
8 changed files with 121 additions and 20 deletions

View file

@ -2,10 +2,13 @@
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <mimalloc.h>
#include <new>
static void double_free();
static void* p = malloc(8);
void free_p() {
@ -24,6 +27,7 @@ public:
int main() {
//mi_stats_reset(); // ignore earlier allocations
double_free();
atexit(free_p);
void* p1 = malloc(78);
void* p2 = mi_malloc_aligned(16,24);
@ -66,3 +70,5 @@ public:
};
static Static s = Static();