From 48705f8aea04dffb7e772784122aa600bbc60cab Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Mon, 11 Sep 2017 12:29:47 +0200 Subject: [PATCH] internal/debug: add debug_setGCPercent --- internal/debug/api.go | 6 ++++++ internal/web3ext/web3ext.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/internal/debug/api.go b/internal/debug/api.go index 7583878ed5..3547b05641 100644 --- a/internal/debug/api.go +++ b/internal/debug/api.go @@ -181,6 +181,12 @@ func (*HandlerT) FreeOSMemory() { debug.FreeOSMemory() } +// SetGCPercent sets the garbage collection target percentage. It returns the previous +// setting. A negative value disables GC. +func (*HandlerT) SetGCPercent(v int) int { + return debug.SetGCPercent(v) +} + func writeProfile(name, file string) error { p := pprof.Lookup(name) log.Info("Writing profile records", "count", p.Count(), "type", name, "dump", file) diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 927085b441..215eae7010 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -267,6 +267,11 @@ web3._extend({ call: 'debug_freeOSMemory', params: 0, }), + new web3._extend.Method({ + name: 'setGCPercent', + call: 'debug_setGCPercent', + params: 1, + }), new web3._extend.Method({ name: 'memStats', call: 'debug_memStats',