mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-07 03:48:42 +03:00
add debug view of arenas
This commit is contained in:
parent
217871cb45
commit
e314699ee0
4 changed files with 49 additions and 5 deletions
|
@ -181,14 +181,15 @@ static void run_os_threads(size_t nthreads, void (*entry)(intptr_t tid));
|
|||
static void test_stress(void) {
|
||||
uintptr_t r = rand();
|
||||
for (int n = 0; n < ITER; n++) {
|
||||
run_os_threads(THREADS, &stress);
|
||||
run_os_threads(THREADS, &stress);
|
||||
for (int i = 0; i < TRANSFERS; i++) {
|
||||
if (chance(50, &r) || n + 1 == ITER) { // free all on last run, otherwise free half of the transfers
|
||||
void* p = atomic_exchange_ptr(&transfer[i], NULL);
|
||||
free_items(p);
|
||||
}
|
||||
}
|
||||
// mi_collect(false);
|
||||
//mi_collect(false);
|
||||
//mi_debug_show_arenas();
|
||||
#if !defined(NDEBUG) || defined(MI_TSAN)
|
||||
if ((n + 1) % 10 == 0) { printf("- iterations left: %3d\n", ITER - (n + 1)); }
|
||||
#endif
|
||||
|
@ -243,7 +244,9 @@ int main(int argc, char** argv) {
|
|||
|
||||
// Run ITER full iterations where half the objects in the transfer buffer survive to the next round.
|
||||
srand(0x7feb352d);
|
||||
|
||||
|
||||
//mi_reserve_os_memory(512ULL << 20, true, true);
|
||||
|
||||
#if !defined(NDEBUG) && !defined(USE_STD_MALLOC)
|
||||
mi_stats_reset();
|
||||
#endif
|
||||
|
@ -256,6 +259,7 @@ int main(int argc, char** argv) {
|
|||
|
||||
#if !defined(NDEBUG) && !defined(USE_STD_MALLOC)
|
||||
mi_collect(true);
|
||||
//mi_debug_show_arenas();
|
||||
#endif
|
||||
#ifndef USE_STD_MALLOC
|
||||
mi_stats_print(NULL);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue