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

goroutine leaks with sync.Pool #1

Open
mostynb opened this issue Mar 12, 2021 · 2 comments
Open

goroutine leaks with sync.Pool #1

mostynb opened this issue Mar 12, 2021 · 2 comments

Comments

@mostynb
Copy link

mostynb commented Mar 12, 2021

github.com/klauspost/compress/zstd Encoders and Decoders leak goroutines if they're garbage collected without calling Close on them first (like sync.Pool does). It's probably not important here, but FYI in case you are doing other experiments with this library.

I have a wrapper that tries to avoid the problem: https://github.com/mostynb/zstdpool-syncpool

var zstdDefaultPool = sync.Pool{

@glukasiknuro
Copy link
Owner

Thanks for the pointer! Yeah, in this case it does not matter, in other use cases I am using https://github.com/DataDog/zstd instead because it was much more cpu friendly for decompression. I'll share some benchmarks slightly later.

@glukasiknuro
Copy link
Owner

Created benchmarks for zstd implementations, based on those benchmarks the cgo implementation is 3x times faster for compression and 6x times faster for decompression: https://github.com/glukasiknuro/go-zstd-benchmarks

Created a bug on go implementation to get insights why this benchmark results are so different than one presented on go zstd implenetation klauspost/compress#444

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

2 participants