package main

import (
	"fmt"
	"runtime"
)

//TraceMemStats 统计程序内存使用
func TraceMemStats() {
	var ms runtime.MemStats
	runtime.ReadMemStats(&ms)
	fmt.Printf("Alloc:已分配的内存大小 ->%.4f(Mb) HeapIdle:堆中空闲的内存大小为->%.4f(Mb) HeapReleased:已释放的堆内存大小为->%.4f(Mb)",
		float64(ms.Alloc)/Mb, float64(ms.HeapIdle)/Mb, float64(ms.HeapReleased)/Mb)
}
