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

GC/Boehm: Silence GC warnings about big allocations. #11289

Merged
merged 4 commits into from
Oct 24, 2021
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
8 changes: 8 additions & 0 deletions src/gc/boehm.cr
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ module GC
LibGC.set_start_callback ->do
GC.lock_write
end
# By default the GC warns on big allocations/reallocations. This
# is of limited use and pollutes program output with warnings.
LibGC.set_warn_proc ->(msg, v) do
format_string = String.new(msg)
unless format_string.starts_with?("GC Warning: Repeated allocation of very large block")
LibC.printf format_string, v
Copy link
Contributor Author

@yxhuvud yxhuvud Oct 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opinions? It felt cleaner to use printf than to rewrite the format string, but 🤷‍♂️

end
end
end

def self.collect
Expand Down