Skip to content

Commit

Permalink
cap the number of GC threads to number of cpu cores
Browse files Browse the repository at this point in the history
  • Loading branch information
d-netto committed Nov 16, 2023
1 parent 7f18f76 commit 1179c8e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,13 @@ void jl_init_threading(void)
else {
jl_n_markthreads = (nthreads / 2) - 1;
}
// if `--gcthreads` or ENV[NUM_GCTHREADS_NAME] was not specified,
// cap the number of threads that may run the mark phase to
// the number of CPU cores
int cpu = jl_cpu_threads();
if (jl_n_markthreads + 1 >= cpu) {
jl_n_markthreads = cpu - 1;
}
}
}
int16_t ngcthreads = jl_n_markthreads + jl_n_sweepthreads;
Expand Down

0 comments on commit 1179c8e

Please sign in to comment.