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 #33

Open
Cyberbeni opened this issue Feb 25, 2025 · 3 comments
Open

Memory leak #33

Cyberbeni opened this issue Feb 25, 2025 · 3 comments

Comments

@Cyberbeni
Copy link

Cyberbeni commented Feb 25, 2025

I am serving a HTML site with a couple js/css files under 100kB and force reloading the site like 30 times causes a massive increase in memory consumption (and keeps increasing if I keep refreshing). Both Linux and macOS. Allocations recording with Instruments:

Image

edit: the other 20% is probably HummingbirdWSCompression:

Image

@adam-fowler
Copy link
Member

Hmm that's not good. I had a quick look and while every deflateInit2 is paired with a deflateEnd it is still leaking memory.

@Cyberbeni
Copy link
Author

deflateEnd calls deflateStateCheck, which seems to care if the z_streamp is still the same: https://github.com/madler/zlib/blob/develop/deflate.c#L535

So I think our z_stream instance needs to be wrapped in an UnsafeMutablePointer to ensure that's the case (like all the lock wrappers).

I'm not at a computer, can only try it later.

@adam-fowler
Copy link
Member

The deflateEnd is returning ok as if it managed to free everything, but it doesn't as far as I can tell.

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