add test case for issue #212

This commit is contained in:
daan 2020-04-06 08:32:25 -07:00
parent 1ece3ff6aa
commit c7e9cfd3ed

View File

@ -20,16 +20,18 @@ static void msleep(unsigned long msecs) { Sleep(msecs); }
static void msleep(unsigned long msecs) { usleep(msecs * 1000UL); } static void msleep(unsigned long msecs) { usleep(msecs * 1000UL); }
#endif #endif
void heap_no_delete(); void heap_thread_free_large(); // issue #212
void heap_late_free(); void heap_no_delete(); // issue #202
void padding_shrink(); void heap_late_free(); // issue #204
void padding_shrink(); // issue #209
void various_tests(); void various_tests();
int main() { int main() {
mi_stats_reset(); // ignore earlier allocations mi_stats_reset(); // ignore earlier allocations
// heap_no_delete(); // issue #202 heap_thread_free_large();
// heap_late_free(); // issue #204 heap_no_delete();
padding_shrink(); // issue #209 heap_late_free();
padding_shrink();
various_tests(); various_tests();
mi_stats_print(NULL); mi_stats_print(NULL);
return 0; return 0;
@ -157,3 +159,17 @@ void padding_shrink(void)
t1.join(); t1.join();
mi_free(shared_p); 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();
}
}