Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.

Memory Leak #55

Open
nook24 opened this issue Mar 22, 2021 · 6 comments
Open

Memory Leak #55

nook24 opened this issue Mar 22, 2021 · 6 comments

Comments

@nook24
Copy link

nook24 commented Mar 22, 2021

Hi,
I'm facing memory leak issues when querying the Windows Event Log through this lib.

I'm new to Golang so properly I'm just doing something wrong. I found the issues #27 and #3 and maybe there is still a memory issue around.

I created a little code snip you can execute which shows the issue: https://github.com/nook24/wmi_windows_eventlog/blob/main/main.go

This Code is running on Windows Server 2016

Bildschirmfoto 2021-03-22 um 17 30 02

Even if the numbers are different from what Task Manager reports the memory usage is rising in Task Manager as well.

memleak

@yusufozturk
Copy link

We are also having same issue and now we are testing it. Anybody else having the same problem?

@yusufozturk
Copy link

We are also having same issue and now we are testing it. Anybody else having the same problem?

In my case, it was due to wrong syscall usage. We use WMI heavily and it's good so far.

@nook24
Copy link
Author

nook24 commented Jul 13, 2021

In my case, it was due to wrong syscall usage. We use WMI heavily and it's good so far.

What do you mean by wrong syscall usage? We are using WMI a lot, and it looks like that the memory leak does only happen when querying the Windows Event Log.
Do you also query the Windows Event Log and if yes, how does your implementation differ from my I posted above?

My current workaround for this is to use PowerShell and not WMI to get the Job done, but I din't like this: https://github.com/it-novum/openitcockpit-agent-go/blob/main/checks/eventlog_windows.go#L90-L117

@yusufozturk
Copy link

I mean, we have a lot of syscalls in the app and one of them was causing our memory leak. In your case, I wouldn't know. But we also have a lot of wmi calls and we don't have any memory leak at the moment, so maybe this package is not the reason.

Fyi, we use syscalls to collect event logs. Using wmi would be slower and would use more resources. I would suggest you to drop wmi calls for events.

For perfmon, I would also suggest syscalls.

@jesus-velez
Copy link

I found this on another thread @nook24 influxdata/telegraf#6807 (comment). Does this help?

@tlimoncelli
Copy link
Contributor

NOTE: This project is no longer being actively maintained.

We recommend you refer to this fork: https://github.com/yusufpapurcu/wmi

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants