Building Gtk2Hs from source no longer needs vast amounts of RAM

Building Gtk2Hs from source used to require wholly unreasonable amounts of memory which caused problems for many users.

But it is a problem no longer! The upcoming Gtk2Hs 0.9.8 release will build using just 80Mb of RAM.

While there was a workaround for machines with less than 512Mb RAM it was not easy to use and was hard for distributors to automate.

The culprit was c2hs which used vast amounts of memory when scanning the C header files. It turned out that it was c2hs’s C parser that was taking so much memory, so we re-wrote it using a different parser technology (the happy parser generator). The result is that processing the Gtk+ C headers with c2hs now takes less than 80Mb of RAM compared to 380Mb previously. It is also several times faster.

The new c2hs C parser is being tested with the Gtk2Hs 0.9.8 release candidate (which you are more than welcome to help test!) The c2hs changes will be submitted back to the main version of c2hs. Hopefully eventually Gtk2Hs will not need to maintain its own fork of c2hs.

2 Responses to “Building Gtk2Hs from source no longer needs vast amounts of RAM”

  1. Scott West Says:

    Hello, this should really go to the mailling list but I don’t want to sign up just for this :)

    Anyway, I did the test specified in the “changes'’ mailing list message and cmp didn’t report anything, so that should be good! Makes me happy anyway, compile times have REALLY improved, thanks so much guys!

  2. duncan Says:

    Thanks very much Scott.

    By the way, for future reference, you can post to the mailing list without being subscribed.