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? #32

Open
anton19286 opened this issue Dec 9, 2015 · 6 comments · May be fixed by #39
Open

Memory leak? #32

anton19286 opened this issue Dec 9, 2015 · 6 comments · May be fixed by #39
Labels

Comments

@anton19286
Copy link

for i:=0; i<40000; i++ {
c, _ := xgb.NewConn()
time.Sleep(10*time.Microsecond)
c.Close()
}
produce 1.5 G of allocation

@BurntSushi
Copy link
Owner

Might be. I think at least two goroutines (generateXIds and generateSeqIds) from each connection will never quit.

Out of curiosity, why are you creating so many connections?

@BurntSushi BurntSushi added the bug label Dec 9, 2015
@anton19286
Copy link
Author

I tried to use vova616/screenshot for VNC server.
It creats and closes new connection on every call.

@BurntSushi
Copy link
Owner

That library should probably expose a way to reuse a connection. Nevertheless, we shouldn't leak goroutines either. :-)

@4nte
Copy link

4nte commented Nov 10, 2020

I'm using https://github.com/kbinani/screenshot which depends on this library.
Everytime this library captures the screen, it creates and closes a new connection - which over time fills the entire memory and crashes.

@jezek
Copy link

jezek commented Nov 10, 2020

@4nte There is a PR #44, which also fixes this issue. I have forked this repo, applied the fix and using it in my projects successfully. Maybe it helps.

If it helps, write it here, maybe it helps to persuade the maintainer to merge the PR.

Side note: There is also a PR #45, which adds some more tests and leakage tests.

@4nte
Copy link

4nte commented Nov 10, 2020

@4nte There is a PR #44, which also fixes this issue. I have forked this repo, applied the fix and using it in my projects successfully. Maybe it helps.

If it helps, write it here, maybe it helps to persuade the maintainer to merge the PR.

Side note: There is also a PR #45, which adds some more tests and leakage tests.

I will rewrite https://github.com/kbinani/screenshot to use your fork and test it.
If it fixes the problem I'll open a PR for kbinani/screenshot to use your fork instead since this issue is pretty old.

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

Successfully merging a pull request may close this issue.

5 participants
@BurntSushi @anton19286 @jezek @4nte and others