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

add test case to check live_bytes doesn't grow arbitrarily on String(::Array{UInt8})) #54371

Merged
merged 1 commit into from
May 6, 2024
Merged
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
23 changes: 23 additions & 0 deletions test/gc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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