4 ms·
The article does not blame lazy evaluation for the problem. The author just could not figure out where the leaks came from. I believe I know where some of the
by jose_zap 7y ago
The article does not blame lazy evaluation for the problem. The author just could not figure out where the leaks came from.
I believe I know where some of the leaks may be coming from. I’m one of the authors of hadolint, the docker file linter. We used ShellCheck as a library to lint the bash code found inside the files.
When we attempted to compile Hadolint to Javascript to embed it on a web page, we discovered that the code in ShellCheck was not optimal. The culprit for our use case was the abuse of regular expressions for checking equality of bash snippets.
In Haskell, most regexp libraries interface with external C libraries and have pinned memory objects for performance, but one must be careful not to accumulate too many of them.
The solution for us to have a usable Javascript version was to reimplement the equality operator for those cases we needed, and now memory usage was down again.
We haven’t stumbled upon our first space leak yet.