@@ -512,7 +512,7 @@ static void mi_segment_os_free(mi_segment_t* segment, size_t segment_size, mi_se
512512 _mi_arena_free (segment , segment_size , committed_size , segment -> memid , tld -> stats );
513513}
514514
515- // called from `heap_collect`.
515+ // called from `heap_collect`.
516516void _mi_segments_collect (bool force , mi_segments_tld_t * tld ) {
517517 mi_pages_try_purge (force ,tld );
518518 #if MI_DEBUG >=2
@@ -563,6 +563,7 @@ static mi_segment_t* mi_segment_os_alloc(bool eager_delayed, size_t page_alignme
563563 segment -> allow_decommit = !memid .is_pinned ;
564564 segment -> allow_purge = segment -> allow_decommit && (mi_option_get (mi_option_purge_delay ) >= 0 );
565565 segment -> segment_size = segment_size ;
566+ segment -> subproc = tld -> subproc ;
566567 mi_segments_track_size ((long )(segment_size ), tld );
567568 _mi_segment_map_allocated_at (segment );
568569 return segment ;
@@ -628,7 +629,6 @@ static mi_segment_t* mi_segment_alloc(size_t required, mi_page_kind_t page_kind,
628629 segment -> segment_info_size = pre_size ;
629630 segment -> thread_id = _mi_thread_id ();
630631 segment -> cookie = _mi_ptr_cookie (segment );
631- segment -> subproc = tld -> subproc ;
632632
633633 // set protection
634634 mi_segment_protect (segment , true, tld -> os );
@@ -896,7 +896,7 @@ static mi_segment_t* mi_segment_reclaim(mi_segment_t* segment, mi_heap_t* heap,
896896 segment -> abandoned -- ;
897897 mi_assert (page -> next == NULL );
898898 _mi_stat_decrease (& tld -> stats -> pages_abandoned , 1 );
899- // get the target heap for this thread which has a matching heap tag (so we reclaim into a matching heap)
899+ // get the target heap for this thread which has a matching heap tag (so we reclaim into a matching heap)
900900 mi_heap_t * target_heap = _mi_heap_by_tag (heap , page -> heap_tag ); // allow custom heaps to separate objects
901901 if (target_heap == NULL ) {
902902 target_heap = heap ;
@@ -961,7 +961,7 @@ bool _mi_segment_attempt_reclaim(mi_heap_t* heap, mi_segment_t* segment) {
961961
962962void _mi_abandoned_reclaim_all (mi_heap_t * heap , mi_segments_tld_t * tld ) {
963963 mi_segment_t * segment ;
964- mi_arena_field_cursor_t current ;
964+ mi_arena_field_cursor_t current ;
965965 _mi_arena_field_cursor_init (heap , tld -> subproc , true /* visit all, blocking */ , & current );
966966 while ((segment = _mi_arena_segment_clear_abandoned_next (& current )) != NULL ) {
967967 mi_segment_reclaim (segment , heap , 0 , NULL , tld );
@@ -989,7 +989,7 @@ static mi_segment_t* mi_segment_try_reclaim(mi_heap_t* heap, size_t block_size,
989989
990990 mi_segment_t * result = NULL ;
991991 mi_segment_t * segment = NULL ;
992- mi_arena_field_cursor_t current ;
992+ mi_arena_field_cursor_t current ;
993993 _mi_arena_field_cursor_init (heap , tld -> subproc , false /* non-blocking */ , & current );
994994 while ((max_tries -- > 0 ) && ((segment = _mi_arena_segment_clear_abandoned_next (& current )) != NULL ))
995995 {
@@ -1264,7 +1264,7 @@ static bool mi_segment_visit_page(mi_page_t* page, bool visit_blocks, mi_block_v
12641264 }
12651265}
12661266
1267- bool _mi_segment_visit_blocks (mi_segment_t * segment , int heap_tag , bool visit_blocks , mi_block_visit_fun * visitor , void * arg ) {
1267+ bool _mi_segment_visit_blocks (mi_segment_t * segment , int heap_tag , bool visit_blocks , mi_block_visit_fun * visitor , void * arg ) {
12681268 for (size_t i = 0 ; i < segment -> capacity ; i ++ ) {
12691269 mi_page_t * const page = & segment -> pages [i ];
12701270 if (page -> segment_in_use ) {
0 commit comments