diff --git a/btcd.go b/btcd.go index 1d1784d5..aec55e06 100644 --- a/btcd.go +++ b/btcd.go @@ -328,11 +328,14 @@ func init() { } func main() { - // Block and transaction processing can cause bursty allocations. This - // limits the garbage collector from excessively overallocating during - // bursts. This value was arrived at with the help of profiling live - // usage. - debug.SetGCPercent(10) + // If GOGC is not explicitly set, override GC percent. + if os.Getenv("GOGC") == "" { + // Block and transaction processing can cause bursty allocations. This + // limits the garbage collector from excessively overallocating during + // bursts. This value was arrived at with the help of profiling live + // usage. + debug.SetGCPercent(10) + } // Up some limits. if err := limits.SetLimits(); err != nil {