EDIT: @rssdev1 itβs obvious, in hindsight, that your test code had 1/4 (for 15 sec.) change of failing! Nothing to do with memory/GC or the new option, which is great! And thanks for fixing the test code now in the PR.
What might be happening in stable version of Julia (or with (or without) this new option in 1.9)? In 1.6.6/1.7.0 (likely all versions sometimes), when the program also (sometimes) seems to hang (meant to run for 15 sec):
$ time julia memory_test.jl
^C
^Z
[1]+ Stopped julia memory_test.jl
real 1m55,687s
Program from:
https://github.com/JuliaLang/julia/pull/45369
Iβve had this fail or succeed with --heap-size-hint=294m
(one lower might always work), but way higher has also worked (and way lower didnβt):
$time ~/julia-1.9-DEV-a60c76ea57/bin/julia --heap-size-hint=360m memory_test.jl
(counter, mem_size) = (163638, 0x01000000)
real 0m15,299s
user 0m13,960s
sys 0m2,883s
$ time ~/julia-1.9-DEV-a60c76ea57/bin/julia --heap-size-hint=380m memory_test.jl
^C
signal (2): Interrupt
in expression starting at /home/pharaldsson_sym/julia_source/julia/memory_test.jl:5
reset_page at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1189 [inlined]
sweep_page at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1337 [inlined]
sweep_pool_page at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1442 [inlined]
sweep_pool_pagetable0 at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1462 [inlined]
sweep_pool_pagetable1 at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1482 [inlined]
sweep_pool_pagetable at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1512 [inlined]
gc_sweep_pool at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1587
_jl_gc_collect at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:3215
ijl_gc_collect at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:3358
maybe_collect at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:898 [inlined]
jl_gc_pool_alloc_inner at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1242 [inlined]
jl_gc_pool_alloc_noinline at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1301
jl_gc_alloc_ at /cache/build/default-amdci5-2/julialang/julia-master/src/julia_internal.h:379 [inlined]
_new_array_ at /cache/build/default-amdci5-2/julialang/julia-master/src/array.c:144 [inlined]
_new_array at /cache/build/default-amdci5-2/julialang/julia-master/src/array.c:198 [inlined]
ijl_alloc_array_1d at /cache/build/default-amdci5-2/julialang/julia-master/src/array.c:436
Array at ./boot.jl:461 [inlined]
Array at ./baseext.jl:23 [inlined]
top-level scope at /home/pharaldsson_sym/julia_source/julia/memory_test.jl:11
jl_toplevel_eval_flex at /cache/build/default-amdci5-2/julialang/julia-master/src/toplevel.c:903
jl_toplevel_eval_flex at /cache/build/default-amdci5-2/julialang/julia-master/src/toplevel.c:856
ijl_toplevel_eval_in at /cache/build/default-amdci5-2/julialang/julia-master/src/toplevel.c:971
eval at ./boot.jl:370 [inlined]
include_string at ./loading.jl:1375
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2393 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2575
_include at ./loading.jl:1435
include at ./Base.jl:418
jfptr_include_33667.clone_1 at /home/pharaldsson_sym/julia-1.9-DEV-a60c76ea57/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2393 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2575
exec_options at ./client.jl:299
_start at ./client.jl:516
jfptr__start_29466.clone_1 at /home/pharaldsson_sym/julia-1.9-DEV-a60c76ea57/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2393 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2575
jl_apply at /cache/build/default-amdci5-2/julialang/julia-master/src/julia.h:1845 [inlined]
true_main at /cache/build/default-amdci5-2/julialang/julia-master/src/jlapi.c:567
jl_repl_entrypoint at /cache/build/default-amdci5-2/julialang/julia-master/src/jlapi.c:711
main at /cache/build/default-amdci5-2/julialang/julia-master/cli/loader_exe.c:59
unknown function (ip: 0x7f383bf4ed8f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x401098)
unknown function (ip: (nil))
Allocations: 1022925 (Pool: 1022713; Big: 212); GC: 392948
real 0m36,161s
user 0m31,910s
sys 0m5,753s
I donβt see any OOM on Linux in /var/log/syslog can someone test on e.g. Windows (or Linux).
I doubt thereβs any safe version where this does work (1.7.0 is my only 1.7.x), or any safe value in 1.9:
$ time ~/julia-1.9-DEV-a60c76ea57/bin/julia --heap-size-hint=10m memory_test.jl
^C
signal (2): Interrupt
in expression starting at /home/pharaldsson_sym/julia_source/julia/memory_test.jl:5
gc_setmark_tag at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:752 [inlined]
gc_try_setmark at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1762 [inlined]
gc_mark_scan_obj8 at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:2001 [inlined]
gc_mark_loop at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:2297
_jl_gc_collect at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:3096
ijl_gc_collect at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:3358
maybe_collect at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:898 [inlined]
jl_gc_pool_alloc_inner at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1242 [inlined]
jl_gc_pool_alloc_noinline at /cache/build/default-amdci5-2/julialang/julia-master/src/gc.c:1301
jl_gc_alloc_ at /cache/build/default-amdci5-2/julialang/julia-master/src/julia_internal.h:379 [inlined]
_new_array_ at /cache/build/default-amdci5-2/julialang/julia-master/src/array.c:144 [inlined]
_new_array at /cache/build/default-amdci5-2/julialang/julia-master/src/array.c:198 [inlined]
ijl_alloc_array_1d at /cache/build/default-amdci5-2/julialang/julia-master/src/array.c:436
Array at ./boot.jl:461 [inlined]
Array at ./baseext.jl:23 [inlined]
top-level scope at /home/pharaldsson_sym/julia_source/julia/memory_test.jl:11
jl_toplevel_eval_flex at /cache/build/default-amdci5-2/julialang/julia-master/src/toplevel.c:903
jl_toplevel_eval_flex at /cache/build/default-amdci5-2/julialang/julia-master/src/toplevel.c:856
ijl_toplevel_eval_in at /cache/build/default-amdci5-2/julialang/julia-master/src/toplevel.c:971
eval at ./boot.jl:370 [inlined]
include_string at ./loading.jl:1375
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2393 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2575
_include at ./loading.jl:1435
include at ./Base.jl:418
jfptr_include_33667.clone_1 at /home/pharaldsson_sym/julia-1.9-DEV-a60c76ea57/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2393 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2575
exec_options at ./client.jl:299
_start at ./client.jl:516
jfptr__start_29466.clone_1 at /home/pharaldsson_sym/julia-1.9-DEV-a60c76ea57/lib/julia/sys.so (unknown line)
_jl_invoke at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2393 [inlined]
ijl_apply_generic at /cache/build/default-amdci5-2/julialang/julia-master/src/gf.c:2575
jl_apply at /cache/build/default-amdci5-2/julialang/julia-master/src/julia.h:1845 [inlined]
true_main at /cache/build/default-amdci5-2/julialang/julia-master/src/jlapi.c:567
jl_repl_entrypoint at /cache/build/default-amdci5-2/julialang/julia-master/src/jlapi.c:711
main at /cache/build/default-amdci5-2/julialang/julia-master/cli/loader_exe.c:59
unknown function (ip: 0x7fcab997dd8f)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x401098)
unknown function (ip: (nil))
Allocations: 237675 (Pool: 237464; Big: 211); GC: 324
real 0m31,044s
user 0m31,381s
sys 0m1,388s