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

When I call net.IOCountersWithContext,memory increase slowly? #1470

Open
1 of 5 tasks
wocan23 opened this issue May 23, 2023 · 0 comments
Open
1 of 5 tasks

When I call net.IOCountersWithContext,memory increase slowly? #1470

wocan23 opened this issue May 23, 2023 · 0 comments

Comments

@wocan23
Copy link

wocan23 commented May 23, 2023

Describe the bug
When I call net.IOCountersWithContext,memory increase slowly. And When I remove that piece of code,memory stable to a certain value,is it the problem of my code?

To Reproduce

	ctx, cancel := context.WithTimeout(context.TODO(), 3*time.Second)
	defer cancel()
	oldIOCountersStats,_ := net.IOCountersWithContext(ctx,false)
	time.Sleep(time.Second)
	newIOCountersStats,_ := net.IOCountersWithContext(ctx,false)
	serverInfo.BytesSent = newIOCountersStats[0].BytesSent - oldIOCountersStats[0].BytesSent
	serverInfo.BytesRecv = newIOCountersStats[0].BytesRecv - oldIOCountersStats[0].BytesRecv

Environment (please complete the following information):

  • Windows: [paste the result of ver]
  • Linux: [paste contents of /etc/os-release and the result of uname -a]
  • Mac OS: [paste the result of sw_vers and uname -a
  • FreeBSD: [paste the result of freebsd-version -k -r -u and uname -a]
  • OpenBSD: [paste the result of uname -a]
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