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
Utilise a Flag to Toggle With the GC #4897
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4897 +/- ##
==========================================
+ Coverage 47.54% 47.56% +0.01%
==========================================
Files 203 204 +1
Lines 15288 15300 +12
==========================================
+ Hits 7269 7277 +8
- Misses 6879 6883 +4
Partials 1140 1140 |
When would someone want to change this from the default? |
@prestonvanloon When they are running the node on a device with restricted amount of memory. Ex: Pi 4. Making the GC more aggressive can prevent OOMs from being triggered |
@@ -126,6 +127,7 @@ func main() { | |||
} | |||
} | |||
|
|||
runtimeDebug.SetGCPercent(ctx.GlobalInt(flags.SetGCPercent.Name)) |
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.
This should only be set if the flag is set, otherwise we are overriding the behavior of the environment variable
The initial setting is the value of the GOGC environment variable at startup, or 100 if the variable is not set.
* set flag * Merge refs/heads/master into setGC
* set flag * Merge refs/heads/master into setGC
Originally a part of #4844
This allows nodes to toggle with the percentage of newly allocated data to live data that the GC is triggered to run again.