diff --git a/test/gc.jl b/test/gc.jl index e9960bc907438..d8e6fe07d0240 100644 --- a/test/gc.jl +++ b/test/gc.jl @@ -28,6 +28,25 @@ function run_pg_size_test() @test page_size == (1 << 12) || page_size == (1 << 14) end +function issue_54275_alloc_string() + String(UInt8['a' for i in 1:10000000]) +end + +function issue_54275_test() + GC.gc(true) + baseline = Base.gc_live_bytes() + live_bytes_has_grown_too_much = false + for _ in 1:10 + issue_54275_alloc_string() + GC.gc(true) + if Base.gc_live_bytes() - baseline > 1_000_000 + live_bytes_has_grown_too_much = true + break + end + end + @test !live_bytes_has_grown_too_much +end + # !!! note: # Since we run our tests on 32bit OS as well we confine ourselves # to parameters that allocate about 512MB of objects. Max RSS is lower @@ -44,6 +63,10 @@ end run_pg_size_test() end +@testset "issue-54275" begin + issue_54275_test() +end + @testset "Base.GC docstrings" begin @test isempty(Docs.undocumented_names(GC)) end