| 489 | } |
| 490 | |
| 491 | static void |
| 492 | tcache_destroy(tsd_t *tsd, tcache_t *tcache, bool tsd_tcache) { |
| 493 | tcache_flush_cache(tsd, tcache); |
| 494 | tcache_arena_dissociate(tsd_tsdn(tsd), tcache); |
| 495 | |
| 496 | if (tsd_tcache) { |
| 497 | /* Release the avail array for the TSD embedded auto tcache. */ |
| 498 | void *avail_array = |
| 499 | (void *)((uintptr_t)tcache_small_bin_get(tcache, 0)->avail - |
| 500 | (uintptr_t)tcache_bin_info[0].ncached_max * sizeof(void *)); |
| 501 | idalloctm(tsd_tsdn(tsd), avail_array, NULL, NULL, true, true); |
| 502 | } else { |
| 503 | /* Release both the tcache struct and avail array. */ |
| 504 | idalloctm(tsd_tsdn(tsd), tcache, NULL, NULL, true, true); |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | /* For auto tcache (embedded in TSD) only. */ |
| 509 | void |
no test coverage detected