From c7e9cfd3ed934addee49f97a65a8d9f622291179 Mon Sep 17 00:00:00 2001 From: daan Date: Mon, 6 Apr 2020 08:32:25 -0700 Subject: [PATCH] add test case for issue #212 --- test/main-override.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/test/main-override.cpp b/test/main-override.cpp index 18d49df3..b0c9fdf0 100644 --- a/test/main-override.cpp +++ b/test/main-override.cpp @@ -20,16 +20,18 @@ static void msleep(unsigned long msecs) { Sleep(msecs); } static void msleep(unsigned long msecs) { usleep(msecs * 1000UL); } #endif -void heap_no_delete(); -void heap_late_free(); -void padding_shrink(); +void heap_thread_free_large(); // issue #212 +void heap_no_delete(); // issue #202 +void heap_late_free(); // issue #204 +void padding_shrink(); // issue #209 void various_tests(); int main() { mi_stats_reset(); // ignore earlier allocations - // heap_no_delete(); // issue #202 - // heap_late_free(); // issue #204 - padding_shrink(); // issue #209 + heap_thread_free_large(); + heap_no_delete(); + heap_late_free(); + padding_shrink(); various_tests(); mi_stats_print(NULL); return 0; @@ -157,3 +159,17 @@ void padding_shrink(void) t1.join(); mi_free(shared_p); } + + +// Issue #221 +void heap_thread_free_large_worker() { + mi_free(shared_p); +} + +void heap_thread_free_large() { + for (int i = 0; i < 100; i++) { + shared_p = mi_malloc(2*1024*1024 + 1); + auto t1 = std::thread(heap_thread_free_large_worker); + t1.join(); + } +}