Skip to content

Commit

Permalink
Utilise a Flag to Toggle With the GC (#4897)
Browse files Browse the repository at this point in the history
* set flag
* Merge refs/heads/master into setGC
  • Loading branch information
nisdas committed Feb 18, 2020
1 parent 3d12322 commit c7d0ced
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions beacon-chain/flags/base.go
Expand Up @@ -74,6 +74,12 @@ var (
Usage: "The eth1 block in which the deposit contract was deployed.",
Value: 1960177,
}
// SetGCPercent is the percentage of current live allocations at which the garbage collector is to run.
SetGCPercent = cli.IntFlag{
Name: "gc-percent",
Usage: "The percentage of freshly allocated data to live data on which the gc will be run again.",
Value: 100,
}
// SlasherCertFlag defines a flag for the slasher TLS certificate.
SlasherCertFlag = cli.StringFlag{
Name: "slasher-tls-cert",
Expand Down
2 changes: 2 additions & 0 deletions beacon-chain/main.go
Expand Up @@ -36,6 +36,7 @@ var appFlags = []cli.Flag{
flags.MinSyncPeers,
flags.RPCMaxPageSize,
flags.ContractDeploymentBlock,
flags.SetGCPercent,
flags.InteropMockEth1DataVotesFlag,
flags.InteropGenesisStateFlag,
flags.InteropNumValidatorsFlag,
Expand Down Expand Up @@ -126,6 +127,7 @@ func main() {
}
}

runtimeDebug.SetGCPercent(ctx.GlobalInt(flags.SetGCPercent.Name))
runtime.GOMAXPROCS(runtime.NumCPU())
return debug.Setup(ctx)
}
Expand Down
1 change: 1 addition & 0 deletions beacon-chain/usage.go
Expand Up @@ -89,6 +89,7 @@ var appHelpFlagGroups = []flagGroup{
flags.KeyFlag,
flags.GRPCGatewayPort,
flags.HTTPWeb3ProviderFlag,
flags.SetGCPercent,
},
},
{
Expand Down

0 comments on commit c7d0ced

Please sign in to comment.