Skip to content

Commit 48705f8

Browse files
committed
internal/debug: add debug_setGCPercent
1 parent 10b3f97 commit 48705f8

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

‎internal/debug/api.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ func (*HandlerT) FreeOSMemory() {
181181
debug.FreeOSMemory()
182182
}
183183

184+
// SetGCPercent sets the garbage collection target percentage. It returns the previous
185+
// setting. A negative value disables GC.
186+
func (*HandlerT) SetGCPercent(v int) int {
187+
return debug.SetGCPercent(v)
188+
}
189+
184190
func writeProfile(name, file string) error {
185191
p := pprof.Lookup(name)
186192
log.Info("Writing profile records", "count", p.Count(), "type", name, "dump", file)

‎internal/web3ext/web3ext.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,11 @@ web3._extend({
267267
call: 'debug_freeOSMemory',
268268
params: 0,
269269
}),
270+
new web3._extend.Method({
271+
name: 'setGCPercent',
272+
call: 'debug_setGCPercent',
273+
params: 1,
274+
}),
270275
new web3._extend.Method({
271276
name: 'memStats',
272277
call: 'debug_memStats',

0 commit comments

Comments
 (0)