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 usage of repl increases after each reload #438

Open
chtenb opened this issue Jan 17, 2024 · 3 comments
Open

Memory usage of repl increases after each reload #438

chtenb opened this issue Jan 17, 2024 · 3 comments

Comments

@chtenb
Copy link
Contributor

chtenb commented Jan 17, 2024

Reproduction
Enter the Koka repl and load some program, like :l samples/all.kk.
Run :r a few times.
Notice the memory usage of the koka process increases with about 50MB each time.
This can get out of hand quite a bit when programming with a repl open for the recompile+test cycle.

Workaround
Exit and restart the repl.

@TimWhiting
Copy link
Collaborator

This is a known issue. It also happens with the language server / vscode extension. I'm pretty sure it has to do with Haskell's laziness. I'd love to figure this out, and I've done some work in trying to figure it out, but haven't ever completely solved the memory leak. Do you have any experience debugging Haskell memory leaks?

@chtenb
Copy link
Contributor Author

chtenb commented Jan 17, 2024

No, unfortunately I have very little experience in using Haskell beyond small toy projects. But I have heard many times people complaining about these bugs being hard to track down. I once saw a talk where someone made a compelling point about the StrictData language extension being very helpful in avoiding accidental memory leaks. But that only works for your own types, the types from libraries (including prelude) keep their own laziness semantics.

@daanx
Copy link
Member

daanx commented Jan 18, 2024

Yes -- there is some kind of space leak... I think it is a laziness issue but haven't been able to find it (yet)... I think it has to do with the modules hanging on to some intermediate (maybe unevaluated) parts... but not sure. We need to bootstrap Koka in Koka some day :-D ... garbage free!

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

No branches or pull requests

3 participants