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

export jl_gc_set_max_memory (#47545) #124

Merged
merged 1 commit into from
Dec 21, 2023
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
3 changes: 2 additions & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3864,7 +3864,8 @@ void jl_gc_init(void)
t_start = jl_hrtime();
}

void jl_gc_set_max_memory(uint64_t max_mem) {
JL_DLLEXPORT void jl_gc_set_max_memory(uint64_t max_mem)
{
if (max_mem > 0
&& max_mem < (uint64_t)1 << (sizeof(memsize_t) * 8 - 1)) {
max_total_memory = max_mem;
Expand Down
1 change: 1 addition & 0 deletions src/jl_exported_funcs.inc
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@
XX(jl_gc_set_cb_pre_gc) \
XX(jl_gc_set_cb_root_scanner) \
XX(jl_gc_set_cb_task_scanner) \
XX(jl_gc_set_max_memory) \
XX(jl_gc_sync_total_bytes) \
XX(jl_gc_total_hrtime) \
XX(jl_gdblookup) \
Expand Down
2 changes: 0 additions & 2 deletions src/jloptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,6 @@ JL_DLLEXPORT void jl_parse_opts(int *argcp, char ***argvp)
break;
}
jl_options.heap_size_hint = (uint64_t)(value * multiplier);

jl_gc_set_max_memory(jl_options.heap_size_hint);
}
}
if (jl_options.heap_size_hint == 0)
Expand Down
2 changes: 2 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@ JL_DLLEXPORT void *jl_malloc_stack(size_t *bufsz, struct _jl_task_t *owner) JL_N
JL_DLLEXPORT void jl_free_stack(void *stkbuf, size_t bufsz);
JL_DLLEXPORT void jl_gc_use(jl_value_t *a);
JL_DLLEXPORT uint64_t jl_gc_get_max_memory(void);
// Set GC memory trigger in bytes for greedy memory collecting
JL_DLLEXPORT void jl_gc_set_max_memory(uint64_t max_mem);

JL_DLLEXPORT void jl_clear_malloc_data(void);

Expand Down
3 changes: 0 additions & 3 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,6 @@ void jl_gc_run_all_finalizers(jl_task_t *ct);
void jl_release_task_stack(jl_ptls_t ptls, jl_task_t *task);
void jl_gc_add_finalizer_(jl_ptls_t ptls, void *v, void *f) JL_NOTSAFEPOINT;

// Set GC memory trigger in bytes for greedy memory collecting
void jl_gc_set_max_memory(uint64_t max_mem);

JL_DLLEXPORT void jl_gc_queue_binding(jl_binding_t *bnd) JL_NOTSAFEPOINT;
void gc_setmark_buf(jl_ptls_t ptls, void *buf, uint8_t, size_t) JL_NOTSAFEPOINT;

Expand Down