@@ -2390,7 +2390,7 @@ FORCE_INLINE void gc_mark_outrefs(jl_ptls_t ptls, jl_gc_markqueue_t *mq, void *_
23902390 int update_meta = __likely (!meta_updated && !gc_verifying );
23912391 int foreign_alloc = 0 ;
23922392 // directly point at eyt_obj_in_img to encourage inlining
2393- if (update_meta && eyt_obj_in_img ( new_obj ) ) {
2393+ if (update_meta && o -> bits . in_image ) {
23942394 foreign_alloc = 1 ;
23952395 update_meta = 0 ;
23962396 }
@@ -3059,12 +3059,14 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
30593059
30603060 // update heuristics only if this GC was automatically triggered
30613061 if (collection == JL_GC_AUTO ) {
3062- if (not_freed_enough ) {
3063- gc_num .interval = gc_num .interval * 2 ;
3064- }
30653062 if (large_frontier ) {
30663063 sweep_full = 1 ;
3064+ gc_num .interval = last_long_collect_interval ;
30673065 }
3066+ if (not_freed_enough || large_frontier ) {
3067+ gc_num .interval = gc_num .interval * 2 ;
3068+ }
3069+
30683070 size_t maxmem = 0 ;
30693071#ifdef _P64
30703072 // on a big memory machine, increase max_collect_interval to totalmem / nthreads / 2
@@ -3097,6 +3099,7 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
30973099 // on the first collection after sweep_full, and the current scan
30983100 perm_scanned_bytes = 0 ;
30993101 promoted_bytes = 0 ;
3102+ last_long_collect_interval = gc_num .interval ;
31003103 }
31013104 scanned_bytes = 0 ;
31023105 // 6. start sweeping
@@ -3166,22 +3169,34 @@ static int _jl_gc_collect(jl_ptls_t ptls, jl_gc_collection_t collection)
31663169 live_bytes += - gc_num .freed + gc_num .since_sweep ;
31673170
31683171 if (collection == JL_GC_AUTO ) {
3172+ //If we aren't freeing enough or are seeing lots and lots of pointers let it increase faster
3173+ if (!not_freed_enough || large_frontier ) {
3174+ int64_t tot = 2 * (live_bytes + gc_num .since_sweep ) / 3 ;
3175+ if (gc_num .interval > tot ) {
3176+ gc_num .interval = tot ;
3177+ last_long_collect_interval = tot ;
3178+ }
31693179 // If the current interval is larger than half the live data decrease the interval
3170- int64_t half = live_bytes /2 ;
3171- if (gc_num .interval > half ) gc_num .interval = half ;
3180+ } else {
3181+ int64_t half = (live_bytes / 2 );
3182+ if (gc_num .interval > half )
3183+ gc_num .interval = half ;
3184+ }
3185+
31723186 // But never go below default
31733187 if (gc_num .interval < default_collect_interval ) gc_num .interval = default_collect_interval ;
31743188 }
31753189
31763190 if (gc_num .interval + live_bytes > max_total_memory ) {
31773191 if (live_bytes < max_total_memory ) {
31783192 gc_num .interval = max_total_memory - live_bytes ;
3193+ last_long_collect_interval = max_total_memory - live_bytes ;
31793194 }
31803195 else {
31813196 // We can't stay under our goal so let's go back to
31823197 // the minimum interval and hope things get better
31833198 gc_num .interval = default_collect_interval ;
3184- }
3199+ }
31853200 }
31863201
31873202 gc_time_summary (sweep_full , t_start , gc_end_time , gc_num .freed ,
0 commit comments