Standard library / runtime

runtime.MemProfileRecord.InUseObjects()

Return allocated minus freed object count for this sampled record. Expected stdout: '3\n'.

Formal Syntax & Structure

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

Return Value

int64

Allocated objects minus freed objects.

Working Example

Example Snippetgo
package main
import (  "fmt"  "runtime")
func main() {  r := runtime.MemProfileRecord{AllocObjects: 5, FreeObjects: 2}  fmt.Println(r.InUseObjects())}
Go Reference