mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 11:34:38 +03:00
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:
parent
fdfa6ed260
commit
2affdbbd2e
8 changed files with 121 additions and 20 deletions
|
@ -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();
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue