Standard library / runtime

runtime.MemProfileRecord.InUseBytes()

Return allocated minus freed bytes for this sampled record. Expected stdout: '60\n'.

Formal Syntax & Structure

go syntaxgo
func (r *MemProfileRecord) InUseBytes() int64

Return Value

int64

Allocated bytes minus freed bytes.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() {  r := runtime.MemProfileRecord{AllocBytes: 100, FreeBytes: 40}  fmt.Println(r.InUseBytes())}
Go Reference