
Greg,
https://github.com/gregorycollins/ghc-echo-leak-bug
The revised echoserver is fine on my machine (stable at 22MB resident) but *the echo client leaks*. Happens with/without -O2 on GHC 7.8.3 for OSX.
I looked at your code very quickly. What happens if you replace "replicateM" and "mapM_" to recursions? (Especially I don't trust replicateM in IO.) Also, we need to confirm that atomicModifyIORef' does not really leak space.
Kazu, I think there's a good chance this is a bug in the multicore IO manager, the test code is doing little more than write + read + threadDelay.
If the space leak also happens with GHC 7.6.3, it is not specific to the multicore IO manager. But the old/new IO manager might have potential space leak. P.S. I'm running Mighty 3 (based on WAI) compiled with GHC 7.8.x for a long time. But I don't see any space leak at all. --Kazu