Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak #18

Open
jbliao opened this issue Mar 29, 2024 · 0 comments
Open

Memory leak #18

jbliao opened this issue Mar 29, 2024 · 0 comments

Comments

@jbliao
Copy link

jbliao commented Mar 29, 2024

Memory will increase dramatically by just execute a script and read response.
The example below will consume your memory 2MB/s, and not go down any more

func do() {

	rs := powershell.CreateRunspaceSimple()
	defer rs.Close()

	script := `
	Get-NetRoute | ConvertTo-Json
	`
	res := rs.ExecScript(script, false, nil)
	defer res.Close()

	log.Println(res.Exception.ToString())

	if len(res.Objects) > 0 {
		log.Println(len(res.Objects[0].ToString()))
	}
}

func main() {
	for {
		do()
	}
}

My application will sleep 5 minutes between every do(), and still increasing. It seams some memory not freed by GOGC

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

No branches or pull requests

1 participant