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

Do full GC if pressure is high #645

Merged
merged 1 commit into from
Jun 16, 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
6 changes: 5 additions & 1 deletion src/memory.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@
min_pressure = blocking ? 0.5 : 0.75
pressure < min_pressure && return

# TODO take allocations into account
# if pressure is high but we didn't allocate - don't collect
# otherwise try hard

# Check that we don't collect too often.
gc_rate = stats.last_gc_time / (current_time - stats.last_time)
# Tolerate 5% GC time.
Expand All @@ -160,7 +164,7 @@
# Call the GC.
Base.@atomic stats.last_time = current_time
pre_gc_live = stats.live
gc_time = Base.@elapsed GC.gc(false)
gc_time = Base.@elapsed GC.gc(pressure > 0.9 ? true : false)

Check warning on line 167 in src/memory.jl

View check run for this annotation

Codecov / codecov/patch

src/memory.jl#L167

Added line #L167 was not covered by tests
post_gc_live = stats.live

# Update stats.
Expand Down