haskell / alex

A lexical analyser generator for Haskell
https://hackage.haskell.org/package/alex
BSD 3-Clause "New" or "Revised" License
298 stars 82 forks source link

Fix a space leak #88

Closed ndmitchell closed 8 years ago

ndmitchell commented 8 years ago

Simple fix for a space leak. Reduces stack usage from 32K to < 1K.

simonmar commented 8 years ago

Interesting, how are you finding these and did they actually matter?

ndmitchell commented 8 years ago

I'm using the techniques from http://neilmitchell.blogspot.co.uk/2015/09/detecting-space-leaks.html. I doubt any of these issues are an actual problem in practice - the code might go a bit slower and use a bit more memory, but it's unlikely to break. My main motivation is to try and convince myself these techniques work, and that they give enough feedback to enable fixing the leaks relatively quickly in an unknown code base. Happy and Alex are just nice examples of good sized projects before I ramp up to bigger things (such as GHC itself).