3 ms·
As someone who's programmed extensively in Haskell, Java, and C++, I would say each of these languages have their own problems regarding memory. Write a decent
by LukeHoersten 11y ago
As someone who's programmed extensively in Haskell, Java, and C++, I would say each of these languages have their own problems regarding memory. Write a decent sized Java application and you will have a ton of memory usage and perhaps space leaks as well. In a moderately complex C++ application, even the best C++ devs will have memory and space leaks.
I think the key here is that Java has JProfiler. C++ and C have Valgrind. Haskell has a heap profiler built right into the compiler. But Haskell doesn't have any specific tools for thunk memory profiling. The discussion in the community is now around building tools and automating this process. It's not like this is a fundamental issue.
Languages that have complex threading and locking also have to have more complex tools to debug these issues (ThreadScope in Haskell, VTune in C++).
What I'm trying to do is put these issues into context. It would be easy for a Python dev with the GIL to scoff at the complexities associated with C++ or Java threading and this is akin to what many do when looking at laziness. Laziness is a feature that comes with it's own types of bugs and we simply need tools to manage and track down those bugs.
The breakthrough with Neil's post is that even with current tools we now have a way to track thunk-based space leaks in Haskell and ideas for some more automation on the way.