add max segment reclaim as an option

This commit is contained in:
Daan Leijen 2022-04-14 16:05:49 -07:00
parent fed9b254a1
commit f87cba9bd8
5 changed files with 11 additions and 3 deletions

View file

@ -1112,7 +1112,7 @@ static mi_segment_t* mi_segment_try_reclaim(mi_heap_t* heap, size_t block_size,
{
*reclaimed = false;
mi_segment_t* segment;
int max_tries = 8; // limit the work to bound allocation times
long max_tries = mi_option_get_clamp(mi_option_max_segment_reclaim, 8, 1024); // limit the work to bound allocation times
while ((max_tries-- > 0) && ((segment = mi_abandoned_pop()) != NULL)) {
segment->abandoned_visits++;
bool all_pages_free;