Standard library / runtime
runtime.MemProfileRate
Controls allocation sampling in average bytes per sample; 0 disables, 1 samples every allocation. Tools assume the rate stays constant; set at startup if needed. This example inspects the default without changing it. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
var MemProfileRate int = 512 * 1024Working Example
Example Snippetgo
package main
import ( "fmt" "runtime")
func main() { fmt.Println(runtime.MemProfileRate >= 0) }