You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: mem_darwin_nocgo.go
    path of file: ./repos/hubble-ui/backend/vendor/github.com/shirou/gopsutil/v3/mem
    
    the code of the file until where you have to start completion: //go:build darwin && !cgo
// +build darwin,!cgo

package mem

import (
	"context"
	"strconv"
	"strings"

	"golang.org/x/sys/unix"
)

// Runs vm_stat and returns Free and inacti
    
func VirtualMemoryWithContext(ctx context.Context) (*VirtualMemoryStat, error) {
	ret := &VirtualMemoryStat{}

	total, err := getHwMemsize()
	if err != nil {
		return nil, err
	}
	err = getVMStat(ret)
	if err != nil {
		return nil, err
	}

	ret.Available = ret.Free + ret.Inactive
	ret.Total = total

	ret.Used = ret.Total - ret.Available
	ret.UsedPercent = 100 * float64(ret.Used) / float64(ret.Total)

	return ret, nil
}