Skip to content
0:00 / 0:00

#ghc#eventlog2html#ghc-debug

Advanced Track: Understanding Memory Usage with eventlog2html and ghc-debug @ZuriHac21

Zürich Friends of Haskell

2K subscribers • 17 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.

Advanced. Deep dive for people who know the field.

1.6K views5 years ago1 recommendation

Programming languagesSystems programmingHaskellPerformance and optimizationMemory management

An advanced session demonstrating how to analyze and debug memory usage in Haskell applications using eventlog2html and ghc-debug.

The uploader added no description.

Why it's here

1 person recommends this

u/n00bombin r/haskell • Recommends

Understanding Memory Usage with eventlog2html and ghc-debug

u/Noughtmarein r/haskell • Mentions

On “The Monad Fear”

You can have memory co-leaks in eager languages (allocating memory too early), but programmers tend to blame themselves for those. Although I'll admit that I have absolutely no idea if it happens as much as memory leaks in Haskell. Also, people are working hard on better profiling tools to be able to spot leaks much more easily: https://well-typed.com/blog/2022/05/hasura-supports-haskell-tooling/ link to this video

u/Noughtmarein r/haskell • Mentions

On “Diagnose memory leaks on PINNED values with GHC 9.2.1 and up”

You might also want to check out eventlog2html and ghc-debug which work out of the box now on GHC 9.2.1 and later. There was a great masterclass about these tools at ZuriHac21.

u/Noughtmarein r/haskell • Mentions

On “Monthly Hask Anything (May 2022)”

Stricness is good for when you know that you need the value to be computed anyway, or if the cost of computing the value is very low (e.g. arithmetic). Another thing strictness is good for is for deallocating dependencies of your values earlier. A lazy value needs to keep all values which it depends on alive, because those dependencies still have to be used to compute the value. I'd say keep as much of your code lazy as you can. The compiler will often figure out which values must be made strict by itself. The compiler is less accurate across modules with exported functions, because it cannot assume it knows all usage sites. That's where you might want to add manual annotations. The com…

u/Noughtmarein r/haskell • Mentions

On “Comparing strict and lazy”

Having better debugging tools makes a big difference in understanding memory usage in Haskell: link to this video

u/Noughtmarein r/haskell • Mentions

On “How can Haskell programmers tolerate Space Leaks?”

Space leaks don't influence the correctness of programs. I think it is rare to get space leaks in Haskell which completely make your code unrunnable on modern hardware, so usually it just means that your programs take more time and space to finish. It is possible to write inefficient programs in any language, so what makes Haskell special? The elephant in the room is lazy evaluation. Obviously, that makes programs perform very differently from what you would expect if you are used to eager languages, but is it really harder to reason about? Of course eager evaluation gives certain guarantees about memory usage, for example a boolean value will only take a constant amount of memory. On the o…