fix(gpu): memory leak on windows (#59)
This commit is contained in:
parent
64ff1e741d
commit
439be0ddf3
@ -30,6 +30,7 @@ var (
|
|||||||
pdhCollectQueryData = modPdh.NewProc("PdhCollectQueryData")
|
pdhCollectQueryData = modPdh.NewProc("PdhCollectQueryData")
|
||||||
pdhGetFormattedCounterArrayW = modPdh.NewProc("PdhGetFormattedCounterArrayW")
|
pdhGetFormattedCounterArrayW = modPdh.NewProc("PdhGetFormattedCounterArrayW")
|
||||||
pdhAddEnglishCounterW = modPdh.NewProc("PdhAddEnglishCounterW")
|
pdhAddEnglishCounterW = modPdh.NewProc("PdhAddEnglishCounterW")
|
||||||
|
pdhCloseQuery = modPdh.NewProc("PdhCloseQuery")
|
||||||
)
|
)
|
||||||
|
|
||||||
type PDH_FMT_COUNTERVALUE_DOUBLE struct {
|
type PDH_FMT_COUNTERVALUE_DOUBLE struct {
|
||||||
@ -131,7 +132,9 @@ func GetGPUStat() (float64, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
values, err := getValue(1024, counter)
|
defer pdhCloseQuery.Call(uintptr(counter.Query))
|
||||||
|
|
||||||
|
values, err := getValue(8192, counter)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user