From 3773f6fe433cc09a4f9ec57297ea1cd074d05262 Mon Sep 17 00:00:00 2001 From: uubulb Date: Sat, 5 Oct 2024 15:29:36 +0800 Subject: [PATCH] fix(mem): possible memory leak on Windows --- mem/mem_windows.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mem/mem_windows.go b/mem/mem_windows.go index 522cfd1b3..a94b61f4b 100644 --- a/mem/mem_windows.go +++ b/mem/mem_windows.go @@ -82,6 +82,8 @@ func SwapMemoryWithContext(ctx context.Context) (*SwapMemoryStat, error) { if err != nil { return nil, err } + defer common.PdhCloseQuery.Call(uintptr(counter.Query)) + usedPercent, err := counter.GetValue() if err != nil { return nil, err