Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport #45727 and a patch to make it work #45938

Merged
merged 2 commits into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3410,12 +3410,12 @@ void jl_gc_init(void)
gc_num.allocd = 0;

#ifdef _P64
// on a big memory machine, set max_collect_interval to totalmem / ncores / 2
// on a big memory machine, set max_collect_interval to totalmem / nthreads / 2
uint64_t total_mem = uv_get_total_memory();
uint64_t constrained_mem = uv_get_constrained_memory();
if (constrained_mem > 0 && constrained_mem < total_mem)
total_mem = constrained_mem;
size_t maxmem = total_mem / jl_cpu_threads() / 2;
size_t maxmem = total_mem / jl_n_threads / 2;
if (maxmem > max_collect_interval)
max_collect_interval = maxmem;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,10 @@ JL_DLLEXPORT void julia_init(JL_IMAGE_SEARCH rel)
}

jl_init_runtime_ccall();
jl_gc_init();
jl_init_tasks();
jl_init_threading();

jl_gc_init();
jl_ptls_t ptls = jl_init_threadtls(0);
// warning: this changes `jl_current_task`, so be careful not to call that from this function
jl_task_t *ct = jl_init_root_task(ptls, stack_lo, stack_hi);
Expand Down