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

[Bug]: memory leaks in conn.release #546

Closed
3 tasks done
panjf2000 opened this issue Mar 18, 2024 · 0 comments · Fixed by #547
Closed
3 tasks done

[Bug]: memory leaks in conn.release #546

panjf2000 opened this issue Mar 18, 2024 · 0 comments · Fixed by #547
Assignees
Labels
bug Something isn't working

Comments

@panjf2000
Copy link
Owner

panjf2000 commented Mar 18, 2024

Actions I've taken before I'm here

  • I've thoroughly read the documentations on this issue but still have no clue.
  • I've searched the Github Issues but didn't find any duplicate issues that have been resolved.
  • I've searched the internet for this issue but didn't find anything helpful.

What happened?

memory leaks of localAddr and remoteAddr:

gnet/connection_unix.go

Lines 86 to 96 in 6d01da7

func (c *conn) release() {
c.ctx = nil
c.localAddr = nil
c.remoteAddr = nil
c.buffer = nil
if addr, ok := c.localAddr.(*net.TCPAddr); ok && c.localAddr != c.loop.ln.addr && len(addr.Zone) > 0 {
bsPool.Put(bs.StringToBytes(addr.Zone))
}
if addr, ok := c.remoteAddr.(*net.TCPAddr); ok && len(addr.Zone) > 0 {
bsPool.Put(bs.StringToBytes(addr.Zone))
}

This issue was introduced by #460

Major version of gnet

v2

Specific version of gnet

v2.3.0-rc.1

Operating system

Linux

OS version

any

Go version

any

Relevant log output

None

Code snippets (optional)

No response

How to Reproduce

Steps to reproduce the behavior:

  1. Go to '....'
  2. Click on '....'
  3. Do '....'
  4. See '....'

Does this issue reproduce with the latest release?

It can reproduce with the latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant