mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-27 13:33:18 +08:00
add test case for issue #212
This commit is contained in:
parent
1ece3ff6aa
commit
c7e9cfd3ed
@ -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();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user