mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-19 21:49:32 +03:00
Added cleanup to test
This commit is contained in:
parent
39f9fb1fbd
commit
99ea9e6c60
2 changed files with 7 additions and 1 deletions
|
@ -13,7 +13,7 @@ option(MI_INTERPOSE "Use interpose to override standard malloc on macOS"
|
|||
option(MI_OSX_ZONE "Use malloc zone to override standard malloc on macOS" OFF) # enables interpose as well
|
||||
option(MI_LOCAL_DYNAMIC_TLS "Use slightly slower, dlopen-compatible TLS mechanism (Unix)" OFF)
|
||||
option(MI_BUILD_TESTS "Build test executables" ON)
|
||||
option(MI_USER_CLEANUP "Enable user defined functionality for custom memory clean function" OFF)
|
||||
option(MI_USER_CLEANUP "Enable user defined functionality for custom memory clean function" ON)
|
||||
option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF)
|
||||
option(MI_PADDING "Enable padding to detect heap block overflow (only in debug mode)" ON)
|
||||
|
||||
|
|
|
@ -63,6 +63,11 @@ static void* atomic_exchange_ptr(volatile void** p, void* newval);
|
|||
|
||||
typedef uintptr_t* random_t;
|
||||
|
||||
void memory_cleanup(void* user_data, void* ptr, size_t size) {
|
||||
(void)user_data;
|
||||
memset(ptr, 0, size);
|
||||
}
|
||||
|
||||
static uintptr_t pick(random_t r) {
|
||||
uintptr_t x = *r;
|
||||
#if (UINTPTR_MAX > UINT32_MAX)
|
||||
|
@ -218,6 +223,7 @@ static void test_leak(void) {
|
|||
#endif
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
mi_register_user_cleanup(memory_cleanup, NULL);
|
||||
// > mimalloc-test-stress [THREADS] [SCALE] [ITER]
|
||||
if (argc >= 2) {
|
||||
char* end;
|
||||
|
|
Loading…
Add table
Reference in a new issue