-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
GC/Boehm: Silence GC warnings about big allocations. #11289
Conversation
These warnings can happen for example when repeatedly adding elements to big arrays or hashes. Unfortunately these warnings are not very helpful and usually just irritating.
Can you please add a comment that explains the reasoning directly in the code? |
src/gc/boehm.cr
Outdated
@@ -126,6 +126,7 @@ module GC | |||
{% end %} | |||
LibGC.init | |||
|
|||
LibGC.set_warn_proc ->(_msg, _v) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment explaining why we are doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @yxhuvud 🙏
Hello folks, I would like to add two issues that were connected to this:
Merging this one will close those two. Cheers. |
Hmm. #11324 seems to be getting warnings like This make me think we should only swallow the repeated allocation warning, and not all other possible warnings. In this case it looks to be an issue about some miswritten finalizer. That seems a lot more helpful than not warning at all. Thoughts? |
Thoughts, would you prefer the check for the above to use a regexp to match against |
Maybe some middle ground (without using regex): msg.starts_with?("GC Warning: Repeated allocation of very large block") |
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 |
There was a problem hiding this comment.
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 🤷♂️
08b8118
to
8c1e225
Compare
These warnings can happen for example when repeatedly adding elements
to big arrays or hashes. Unfortunately these warnings are not very
helpful and usually just irritating.
Fixes #11274