Standard library / runtime/pprof

pprof.Profile.Remove()

Remove the stack associated with a key; an absent key is a no-op. Expected stdout: '0\n'.

Formal Syntax & Structure

go syntaxgo
func (p *Profile) Remove(value any)

Parameters & Attributes

NameTypeDescription
valueanyComparable key identifying a tracked resource or stack.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime/pprof")
func main() {  p := pprof.NewProfile("bytemind.resource")  p.Add("demo", 0)  p.Remove("demo")  p.Remove("demo")  fmt.Println(p.Count())}
Go Reference