Attempted to fix various memory-issues.

Still failing, but getting better behaviour and profiling is more
useful.

I think that I need to use Data.Text.copy, but that's only available
later. Perhaps there's a similar function for ByteString, and I can
apply it before decoding the input to Text.